Skip to content

Commit

Permalink
Implement maintains_input_order for AggregateExec (#13897)
Browse files Browse the repository at this point in the history
* Implement maintains_input_order for AggregateExec

* Update mod.rs

* Improve comments

---------

Co-authored-by: berkaysynnada <berkay.sahin@synnada.ai>
Co-authored-by: mertak-synnada <mertak67+synaada@gmail.com>
Co-authored-by: Mehmet Ozan Kabak <ozankabak@gmail.com>
  • Loading branch information
4 people authored Dec 27, 2024
1 parent 933fec8 commit d25099e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions datafusion/physical-plan/src/aggregates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,19 @@ impl ExecutionPlan for AggregateExec {
vec![self.required_input_ordering.clone()]
}

/// The output ordering of [`AggregateExec`] is determined by its `group_by`
/// columns. Although this method is not explicitly used by any optimizer
/// rules yet, overriding the default implementation ensures that it
/// accurately reflects the actual behavior.
///
/// If the [`InputOrderMode`] is `Linear`, the `group_by` columns don't have
/// an ordering, which means the results do not either. However, in the
/// `Ordered` and `PartiallyOrdered` cases, the `group_by` columns do have
/// an ordering, which is preserved in the output.
fn maintains_input_order(&self) -> Vec<bool> {
vec![self.input_order_mode != InputOrderMode::Linear]
}

fn children(&self) -> Vec<&Arc<dyn ExecutionPlan>> {
vec![&self.input]
}
Expand Down

0 comments on commit d25099e

Please sign in to comment.