Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5a906c6
update
daviszhen Aug 7, 2026
a12cec5
update
daviszhen Aug 7, 2026
b98f188
Merge branch 'main' into 0807-add-within-group-by
daviszhen Aug 7, 2026
ef2a72a
update
daviszhen Aug 7, 2026
4346d1a
Merge branch '0807-add-within-group-by' of https://github.com/daviszh…
daviszhen Aug 7, 2026
26a3dc8
update
daviszhen Aug 7, 2026
125e4b6
Merge branch 'main' into 0807-add-within-group-by
daviszhen Aug 7, 2026
6f720e7
update
daviszhen Aug 7, 2026
82b477a
Merge branch '0807-add-within-group-by' of https://github.com/daviszh…
daviszhen Aug 7, 2026
d57670d
Merge branch 'main' into 0807-add-within-group-by
daviszhen Aug 7, 2026
bae0e69
Merge branch 'main' into 0807-add-within-group-by
daviszhen Aug 7, 2026
d0d989b
update
daviszhen Aug 9, 2026
b436558
update
daviszhen Aug 9, 2026
3aa363a
Merge branch '0807-add-within-group-by' of https://github.com/daviszh…
daviszhen Aug 9, 2026
6fc7078
Merge branch 'main' into 0807-add-within-group-by
daviszhen Aug 9, 2026
037d7c1
update
daviszhen Aug 10, 2026
dec1193
update
daviszhen Aug 10, 2026
b46844d
update
daviszhen Aug 10, 2026
4ff5175
Merge branch 'main' into 0807-add-within-group-by
daviszhen Aug 10, 2026
15d9b16
Merge branch 'main' into 0807-add-within-group-by
daviszhen Aug 10, 2026
9ba5869
update:
daviszhen Aug 10, 2026
178c2dd
Merge branch 'main' into 0807-add-within-group-by
daviszhen Aug 10, 2026
b2ebbf6
update
daviszhen Aug 10, 2026
9ca51a9
Merge branch 'main' of https://github.com/matrixorigin/matrixone into…
daviszhen Aug 10, 2026
902c821
Merge branch 'main' of https://github.com/matrixorigin/matrixone into…
daviszhen Aug 11, 2026
e356083
update
daviszhen Aug 11, 2026
01f50c8
Merge branch 'main' of https://github.com/matrixorigin/matrixone into…
daviszhen Aug 11, 2026
ab71d04
Merge branch 'main' into 0807-add-within-group-by
daviszhen Aug 11, 2026
4f620ec
Merge branch 'main' into 0807-add-within-group-by
daviszhen Aug 11, 2026
2052259
Merge branch 'main' of https://github.com/matrixorigin/matrixone into…
daviszhen Aug 11, 2026
cda7521
update
daviszhen Aug 11, 2026
1eb5c51
Merge branch 'main' into 0807-add-within-group-by
daviszhen Aug 11, 2026
62ca3b7
Merge branch 'main' into 0807-add-within-group-by
mergify[bot] Aug 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pkg/sql/colexec/aggexec/concat2.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ func EncodeGroupConcatOrderedConfig(config []byte, maxLen uint64) []byte {
return runtimeConfig
}

// HasGroupConcatOrder reports whether a GROUP_CONCAT_ORDER configuration
// contains at least one real ORDER BY argument. The aggregate config is
// carried in two forms: the plan payload starts with the version byte, while
// the execution payload may be prefixed by the runtime max-length header.
// Invalid payloads are treated as unordered so callers fail closed when
// deciding whether generic DISTINCT spill is safe.
func HasGroupConcatOrder(config []byte) bool {
if len(config) >= groupConcatOrderedConfigHeaderSize &&
bytes.Equal(config[:len(groupConcatOrderedConfigMagic)], groupConcatOrderedConfigMagic) {
config = config[groupConcatOrderedConfigHeaderSize:]
}
_, orderArgIndexes, _, _, _, err := decodeGroupConcatOrderConfig(config)
return err == nil && len(orderArgIndexes) > 0
}

func RefreshGroupConcatConfigMaxLen(config []byte, maxLen uint64) []byte {
if len(config) >= groupConcatOrderedConfigHeaderSize &&
bytes.Equal(config[:len(groupConcatOrderedConfigMagic)], groupConcatOrderedConfigMagic) {
Expand Down
13 changes: 13 additions & 0 deletions pkg/sql/colexec/aggexec/concat2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,19 @@ func TestGroupConcatOrderConfigValidationAndReturnType(t *testing.T) {
})
}

func TestHasGroupConcatOrder(t *testing.T) {
ordered := testGroupConcatOrderConfig(1, []byte{groupConcatOrderAsc}, "|").Data
unordered := testGroupConcatOrderConfig(1, nil, "|").Data
malformed := []byte{groupConcatOrderConfigVersion}

require.True(t, HasGroupConcatOrder(ordered))
require.True(t, HasGroupConcatOrder(EncodeGroupConcatOrderedConfig(ordered, 10)))
require.False(t, HasGroupConcatOrder(unordered))
require.False(t, HasGroupConcatOrder(EncodeGroupConcatOrderedConfig(unordered, 10)))
require.False(t, HasGroupConcatOrder(malformed))
require.False(t, HasGroupConcatOrder(EncodeGroupConcatConfig("|", 10)))
}

func TestGroupConcatOrderedMaxLen(t *testing.T) {
mp := mpool.MustNewZero()
info := multiAggInfo{
Expand Down
3 changes: 2 additions & 1 deletion pkg/sql/colexec/aggexec/empty_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ func GetEmptyResultKind(aggID int64) EmptyResultKind {
return EmptyResultZero
case AggIdOfAny, AggIdOfAvg, AggIdOfGroupConcat, AggIdOfJsonArrayAgg,
AggIdOfJsonObjectAgg, AggIdOfMax, AggIdOfMaxBy, AggIdOfMaxByNonNull,
AggIdOfMedian, AggIdOfMin, AggIdOfApproxPercentile, AggIdOfStdDevPop,
AggIdOfMedian, AggIdOfMin, AggIdOfApproxPercentile, AggIdOfPercentileCont,
AggIdOfPercentileDisc, AggIdOfStdDevPop,
AggIdOfStdDevSample, AggIdOfSum, AggIdOfVarPop, AggIdOfVarSample:
return EmptyResultNull
case AggIdOfAvgTwCache, AggIdOfAvgTwResult, AggIdOfBitmapConstruct,
Expand Down
2 changes: 2 additions & 0 deletions pkg/sql/colexec/aggexec/function_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ const (
AggIdOfApproxPercentile int64 = 557 << 32
AggIdOfMaxBy int64 = 559 << 32
AggIdOfMaxByNonNull int64 = 560 << 32
AggIdOfPercentileCont int64 = 562 << 32
AggIdOfPercentileDisc int64 = 563 << 32
)
Loading
Loading