Skip to content

Commit fb79f13

Browse files
authored
fix(query): fix aggregator_groups_builder to work with string view (#16843)
1 parent fea4409 commit fb79f13

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

โ€Žsrc/query/service/src/pipelines/processors/transforms/group_by/aggregator_groups_builder.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ impl<'a> SerializedKeysGroupColumnsBuilder<'a> {
9292
Some(StringColumnBuilder::with_capacity(capacity)),
9393
vec![],
9494
)
95-
} else {
95+
} else if params.group_data_types[0].is_binary()
96+
|| params.group_data_types[0].is_variant()
97+
{
9698
(
9799
Some(BinaryColumnBuilder::with_capacity(capacity, data_capacity)),
98100
None,
99101
vec![],
100102
)
103+
} else {
104+
(None, None, Vec::with_capacity(capacity))
101105
}
102106
} else {
103107
(None, None, Vec::with_capacity(capacity))

โ€Žtests/sqllogictests/suites/base/03_common/03_0003_select_group_by.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ SELECT number%3 as c1 FROM numbers_mt(10) where number > 2 group by number%3 ord
2121
1
2222
2
2323

24+
query I
25+
SELECT try_cast(number % 3 as string) c1, count() FROM numbers_mt(10) where number > 2 group by c1 order by c1
26+
----
27+
0 3
28+
1 2
29+
2 2
30+
2431
query III
2532
SELECT a,b,count() from (SELECT cast((number%4) AS bigint) as a, cast((number%20) AS bigint) as b from numbers(100)) group by a,b order by a,b limit 3
2633
----
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
statement ok
2+
set enable_experimental_aggregate_hashtable = 0;
3+
4+
include ./03_0003_select_group_by.test
5+
6+
statement ok
7+
unset enable_experimental_aggregate_hashtable;

0 commit comments

Comments
ย (0)