This is an automated email from the ASF dual-hosted git repository.

berkay pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new d25099e25d Implement maintains_input_order for AggregateExec (#13897)
d25099e25d is described below

commit d25099e25df8dcf9940143864e73ab240116fd6b
Author: Alihan Çelikcan <[email protected]>
AuthorDate: Fri Dec 27 14:09:40 2024 +0300

    Implement maintains_input_order for AggregateExec (#13897)
    
    * Implement maintains_input_order for AggregateExec
    
    * Update mod.rs
    
    * Improve comments
    
    ---------
    
    Co-authored-by: berkaysynnada <[email protected]>
    Co-authored-by: mertak-synnada <[email protected]>
    Co-authored-by: Mehmet Ozan Kabak <[email protected]>
---
 datafusion/physical-plan/src/aggregates/mod.rs | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/datafusion/physical-plan/src/aggregates/mod.rs 
b/datafusion/physical-plan/src/aggregates/mod.rs
index 2e0103defd..c04211d679 100644
--- a/datafusion/physical-plan/src/aggregates/mod.rs
+++ b/datafusion/physical-plan/src/aggregates/mod.rs
@@ -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]
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to