Skip to content

Commit 59561f0

Browse files
committed
fix(substrait): avoid using empty GroupingSet when groupings is empty
When groupings is empty, we should set group_exprs to the empty vector instead of a vector containing a single empty GroupingSet. The issue with the latter is that it triggers the addition of the extra "__grouping_id" column in the Aggregate node, which is redundant in this case AND causes conflicts in the output schema because Substrait does not expect it.
1 parent 2f7d7d3 commit 59561f0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

datafusion/substrait/src/logical_plan/consumer/rel/aggregate_rel.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pub async fn from_aggregate_rel(
4040
let mut aggr_exprs = vec![];
4141

4242
match agg.groupings.len() {
43+
0 => {}
4344
1 => {
4445
group_exprs.extend_from_slice(
4546
&from_substrait_grouping(

0 commit comments

Comments
 (0)