@@ -707,10 +707,6 @@ impl DefaultPhysicalPlanner {
707707 physical_input_schema. clone ( ) ,
708708 ) ?) ;
709709
710- // update group column indices based on partial aggregate plan evaluation
711- let final_group: Vec < Arc < dyn PhysicalExpr > > =
712- initial_aggr. output_group_expr ( ) ;
713-
714710 let can_repartition = !groups. is_empty ( )
715711 && session_state. config ( ) . target_partitions ( ) > 1
716712 && session_state. config ( ) . repartition_aggregations ( ) ;
@@ -731,13 +727,7 @@ impl DefaultPhysicalPlanner {
731727 AggregateMode :: Final
732728 } ;
733729
734- let final_grouping_set = PhysicalGroupBy :: new_single (
735- final_group
736- . iter ( )
737- . enumerate ( )
738- . map ( |( i, expr) | ( expr. clone ( ) , groups. expr ( ) [ i] . 1 . clone ( ) ) )
739- . collect ( ) ,
740- ) ;
730+ let final_grouping_set = initial_aggr. group_expr ( ) . as_final ( ) ;
741731
742732 Arc :: new ( AggregateExec :: try_new (
743733 next_partition_mode,
@@ -2061,7 +2051,7 @@ mod tests {
20612051 & session_state,
20622052 ) ;
20632053
2064- let expected = r#"Ok(PhysicalGroupBy { expr: [(Column { name: "c1", index: 0 }, "c1"), (Column { name: "c2", index: 1 }, "c2"), (Column { name: "c3", index: 2 }, "c3")], null_expr: [(Literal { value: Utf8(NULL) }, "c1"), (Literal { value: Int64(NULL) }, "c2"), (Literal { value: Int64(NULL) }, "c3")], groups: [[false, false, false], [true, false, false], [false, true, false], [false, false, true], [true, true, false], [true, false, true], [false, true, true], [true, true, true]] })"# ;
2054+ let expected = r#"Ok(PhysicalGroupBy { expr: [(Column { name: "c1", index: 0 }, "c1"), (Column { name: "c2", index: 1 }, "c2"), (Column { name: "c3", index: 2 }, "c3")], null_expr: [(Literal { value: Utf8(NULL) }, "c1"), (Literal { value: Int64(NULL) }, "c2"), (Literal { value: Int64(NULL) }, "c3")], groups: [[false, false, false], [true, false, false], [false, true, false], [false, false, true], [true, true, false], [true, false, true], [false, true, true], [true, true, true]], num_internal_exprs: 1 })"# ;
20652055
20662056 assert_eq ! ( format!( "{cube:?}" ) , expected) ;
20672057
@@ -2088,7 +2078,7 @@ mod tests {
20882078 & session_state,
20892079 ) ;
20902080
2091- let expected = r#"Ok(PhysicalGroupBy { expr: [(Column { name: "c1", index: 0 }, "c1"), (Column { name: "c2", index: 1 }, "c2"), (Column { name: "c3", index: 2 }, "c3")], null_expr: [(Literal { value: Utf8(NULL) }, "c1"), (Literal { value: Int64(NULL) }, "c2"), (Literal { value: Int64(NULL) }, "c3")], groups: [[true, true, true], [false, true, true], [false, false, true], [false, false, false]] })"# ;
2081+ let expected = r#"Ok(PhysicalGroupBy { expr: [(Column { name: "c1", index: 0 }, "c1"), (Column { name: "c2", index: 1 }, "c2"), (Column { name: "c3", index: 2 }, "c3")], null_expr: [(Literal { value: Utf8(NULL) }, "c1"), (Literal { value: Int64(NULL) }, "c2"), (Literal { value: Int64(NULL) }, "c3")], groups: [[true, true, true], [false, true, true], [false, false, true], [false, false, false]], num_internal_exprs: 1 })"# ;
20922082
20932083 assert_eq ! ( format!( "{rollup:?}" ) , expected) ;
20942084
0 commit comments