@@ -27,11 +27,9 @@ use crate::aggregates::{
2727} ;
2828
2929use crate :: metrics:: { ExecutionPlanMetricsSet , MetricsSet } ;
30- use crate :: windows:: {
31- get_ordered_partition_by_indices, get_window_mode, PartitionSearchMode ,
32- } ;
30+ use crate :: windows:: { get_ordered_partition_by_indices, get_window_mode} ;
3331use crate :: {
34- DisplayFormatType , Distribution , ExecutionPlan , Partitioning ,
32+ DisplayFormatType , Distribution , ExecutionPlan , InputOrderMode , Partitioning ,
3533 SendableRecordBatchStream , Statistics ,
3634} ;
3735
@@ -304,7 +302,9 @@ pub struct AggregateExec {
304302 /// Execution metrics
305303 metrics : ExecutionPlanMetricsSet ,
306304 required_input_ordering : Option < LexRequirement > ,
307- partition_search_mode : PartitionSearchMode ,
305+ /// Describes how the input is ordered relative to the group by columns
306+ input_order_mode : InputOrderMode ,
307+ /// Describe how the output is ordered
308308 output_ordering : Option < LexOrdering > ,
309309}
310310
@@ -409,15 +409,15 @@ fn get_aggregate_search_mode(
409409 aggr_expr : & mut [ Arc < dyn AggregateExpr > ] ,
410410 order_by_expr : & mut [ Option < LexOrdering > ] ,
411411 ordering_req : & mut Vec < PhysicalSortExpr > ,
412- ) -> PartitionSearchMode {
412+ ) -> InputOrderMode {
413413 let groupby_exprs = group_by
414414 . expr
415415 . iter ( )
416416 . map ( |( item, _) | item. clone ( ) )
417417 . collect :: < Vec < _ > > ( ) ;
418- let mut partition_search_mode = PartitionSearchMode :: Linear ;
418+ let mut input_order_mode = InputOrderMode :: Linear ;
419419 if !group_by. is_single ( ) || groupby_exprs. is_empty ( ) {
420- return partition_search_mode ;
420+ return input_order_mode ;
421421 }
422422
423423 if let Some ( ( should_reverse, mode) ) =
@@ -439,9 +439,9 @@ fn get_aggregate_search_mode(
439439 ) ;
440440 * ordering_req = reverse_order_bys ( ordering_req) ;
441441 }
442- partition_search_mode = mode;
442+ input_order_mode = mode;
443443 }
444- partition_search_mode
444+ input_order_mode
445445}
446446
447447/// Check whether group by expression contains all of the expression inside `requirement`
@@ -515,7 +515,7 @@ impl AggregateExec {
515515 & input. equivalence_properties ( ) ,
516516 ) ?;
517517 let mut ordering_req = requirement. unwrap_or ( vec ! [ ] ) ;
518- let partition_search_mode = get_aggregate_search_mode (
518+ let input_order_mode = get_aggregate_search_mode (
519519 & group_by,
520520 & input,
521521 & mut aggr_expr,
@@ -567,7 +567,7 @@ impl AggregateExec {
567567 metrics : ExecutionPlanMetricsSet :: new ( ) ,
568568 required_input_ordering,
569569 limit : None ,
570- partition_search_mode ,
570+ input_order_mode ,
571571 output_ordering,
572572 } )
573573 }
@@ -767,8 +767,8 @@ impl DisplayAs for AggregateExec {
767767 write ! ( f, ", lim=[{limit}]" ) ?;
768768 }
769769
770- if self . partition_search_mode != PartitionSearchMode :: Linear {
771- write ! ( f, ", ordering_mode={:?}" , self . partition_search_mode ) ?;
770+ if self . input_order_mode != InputOrderMode :: Linear {
771+ write ! ( f, ", ordering_mode={:?}" , self . input_order_mode ) ?;
772772 }
773773 }
774774 }
@@ -819,7 +819,7 @@ impl ExecutionPlan for AggregateExec {
819819 /// infinite, returns an error to indicate this.
820820 fn unbounded_output ( & self , children : & [ bool ] ) -> Result < bool > {
821821 if children[ 0 ] {
822- if self . partition_search_mode == PartitionSearchMode :: Linear {
822+ if self . input_order_mode == InputOrderMode :: Linear {
823823 // Cannot run without breaking pipeline.
824824 plan_err ! (
825825 "Aggregate Error: `GROUP BY` clauses with columns without ordering and GROUPING SETS are not supported for unbounded inputs."
0 commit comments