Skip to content

Commit

Permalink
Fix bug of groupby expression.
Browse files Browse the repository at this point in the history
  • Loading branch information
small-turtle-1 committed Jan 23, 2025
1 parent 31fb191 commit a0f35b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/executor/operator/physical_aggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool PhysicalAggregate::Execute(QueryContext *query_context, OperatorState *oper

groupby_table->data_blocks_.emplace_back(DataBlock::MakeUniquePtr());
DataBlock *output_data_block = groupby_table->data_blocks_.back().get();
output_data_block->Init(groupby_types, 1);
output_data_block->Init(groupby_types);

ExpressionEvaluator groupby_executor;
groupby_executor.Init(input_data_block);
Expand Down
17 changes: 17 additions & 0 deletions test/sql/dql/aggregate/test_groupby_complex.slt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ SELECT c1, c2, SUM(c3) FROM simple_groupby GROUP BY c1, c2;
2 2 10.000000
2 3 10.000000

query IR rowsort
SELECT c1+c2, SUM(c3) FROM simple_groupby GROUP BY c1+c2;
----
2 8.000000
3 14.000000
4 14.000000
5 10.000000

query IIR rowsort
SELECT abs(c1-c2), c1+c2, SUM(c3) FROM simple_groupby GROUP BY abs(c1-c2), c1+c2;
----
0 2 8.000000
0 4 10.000000
1 3 14.000000
1 5 10.000000
2 4 4.000000

query IIR rowsort
SELECT c1, c2, SUM(c3) FROM simple_groupby WHERE c1 > 1 GROUP BY c1, c2;
----
Expand Down

0 comments on commit a0f35b4

Please sign in to comment.