You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by vi...@apache.org on 2024/02/17 19:15:47 UTC

(arrow-datafusion) branch main updated: Add more doc to InputOrderMode (#9255)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new d4357ec42b Add more doc to InputOrderMode (#9255)
d4357ec42b is described below

commit d4357ec42b7759402a60020266ca64508f8fa99a
Author: Liang-Chi Hsieh <vi...@gmail.com>
AuthorDate: Sat Feb 17 11:15:43 2024 -0800

    Add more doc to InputOrderMode (#9255)
---
 datafusion/physical-plan/src/ordering.rs    | 11 +++++++----
 datafusion/physical-plan/src/windows/mod.rs |  8 ++++----
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/datafusion/physical-plan/src/ordering.rs b/datafusion/physical-plan/src/ordering.rs
index 047f89eef1..8b596b9cb2 100644
--- a/datafusion/physical-plan/src/ordering.rs
+++ b/datafusion/physical-plan/src/ordering.rs
@@ -28,11 +28,14 @@
 /// - A `PARTITION BY a, b` or a `PARTITION BY b, a` can use `Sorted` mode.
 ///
 /// ## Aggregations
-/// - A `GROUP BY b` clause can use `Linear` mode.
-/// - A `GROUP BY a, c` or a `GROUP BY BY c, a` can use
-///   `PartiallySorted([0])` or `PartiallySorted([1])` modes, respectively.
+/// - A `GROUP BY b` clause can use `Linear` mode, as the only one permutation `[b]`
+///   cannot satisfy the existing ordering.
+/// - A `GROUP BY a, c` or a `GROUP BY c, a` can use
+///   `PartiallySorted([0])` or `PartiallySorted([1])` modes, respectively, as
+///   the permutation `[a]` satisfies the existing ordering.
 ///   (The vector stores the index of `a` in the respective PARTITION BY expression.)
-/// - A `GROUP BY a, b` or a `GROUP BY b, a` can use `Sorted` mode.
+/// - A `GROUP BY a, b` or a `GROUP BY b, a` can use `Sorted` mode, as the
+///   full permutation `[a, b]` satisfies the existing ordering.
 ///
 /// Note these are the same examples as above, but with `GROUP BY` instead of
 /// `PARTITION BY` to make the examples easier to read.
diff --git a/datafusion/physical-plan/src/windows/mod.rs b/datafusion/physical-plan/src/windows/mod.rs
index 01818405b8..693d20e90a 100644
--- a/datafusion/physical-plan/src/windows/mod.rs
+++ b/datafusion/physical-plan/src/windows/mod.rs
@@ -329,11 +329,11 @@ pub(crate) fn calc_requirements<
     (!sort_reqs.is_empty()).then_some(sort_reqs)
 }
 
-/// This function calculates the indices such that when partition by expressions reordered with this indices
+/// This function calculates the indices such that when partition by expressions reordered with the indices
 /// resulting expressions define a preset for existing ordering.
-// For instance, if input is ordered by a, b, c and PARTITION BY b, a is used
-// This vector will be [1, 0]. It means that when we iterate b,a columns with the order [1, 0]
-// resulting vector (a, b) is a preset of the existing ordering (a, b, c).
+/// For instance, if input is ordered by a, b, c and PARTITION BY b, a is used,
+/// this vector will be [1, 0]. It means that when we iterate b, a columns with the order [1, 0]
+/// resulting vector (a, b) is a preset of the existing ordering (a, b, c).
 pub(crate) fn get_ordered_partition_by_indices(
     partition_by_exprs: &[Arc<dyn PhysicalExpr>],
     input: &Arc<dyn ExecutionPlan>,