Skip to content

Apache DataFusion SQL Query Engine

fix: retain only valid orderings after order-preserving repartition (#26747)

Kristoffer Vestergård Johansson99e723dd47f5
diff --git a/datafusion/physical-expr/src/equivalence/class.rs b/datafusion/physical-expr/src/equivalence/class.rs
index 215cdf2358..352d690a54 100644
--- a/datafusion/physical-expr/src/equivalence/class.rs
+++ b/datafusion/physical-expr/src/equivalence/class.rs
@@ -9,7 +9,7 @@ use std::sync::Arc;
use std::vec::IntoIter;
use super::ProjectionMapping;
-use crate::expressions::Literal;
+use crate::expressions::{Column, Literal};
use crate::physical_expr::add_offset_to_expr;
use crate::projection::ProjectionTargets;
use crate::{PhysicalExpr, PhysicalExprRef, PhysicalSortExpr, PhysicalSortRequirement};
@@ -17,7 +17,9 @@ use crate::{PhysicalExpr, PhysicalExprRef, PhysicalSortExpr, PhysicalSortRequire
use datafusion_common::tree_node::{Transformed, TransformedResult, TreeNode};
use datafusion_common::{JoinType, Result, ScalarValue};
use datafusion_expr::sort_properties::SortProperties;
-use datafusion_physical_expr_common::physical_expr::format_physical_expr_list;
+use datafusion_physical_expr_common::physical_expr::{
+ format_physical_expr_list, is_volatile,
+};
use indexmap::{IndexMap, IndexSet};
@@ -172,6 +174,14 @@ pub struct EquivalenceClass {
}
impl EquivalenceClass {
+ /// Keeps what still holds on a join side whose unmatched rows are padded
+ /// with NULLs: padded columns stay equal to each other, but constants and
+ /// computed members do not (`coalesce(a, 0)` is 0 where `a` is NULL).
+ fn null_pad(&mut self) {
+ self.constant = None;
+ self.exprs.retain(|expr| expr.is::<Column>());
+ }
+
// Create a new equivalence class from a pre-existing collection.
pub fn new(exprs: impl IntoIterator<Item = Arc<dyn PhysicalExpr>>) -> Self {
let mut class = Self::default();
@@ -740,6 +750,7 @@ impl EquivalenceGroup {
let mut new_constants = vec![];
let mut new_classes =
IndexMap::<_, EquivalenceClass>::with_capacity(mapping.len());
+ let mut augmented = None;
for (source, targets) in mapping.iter() {
// We need to find equivalent projected expressions. For example,
// consider a table with columns `[a, b, c]` with `a` == `b`, and
@@ -751,6 +762,15 @@ impl EquivalenceGroup {
for (target, _) in targets.iter() {
cls.push(Arc::clone(target));
}
+ // Retain deterministic expressions as equalities so orderings derived
+ // through strict functions can be inferred after a merge clears orderings.
+ if !source.children().is_empty() && !is_volatile(source) {
+ let augmented = augmented
+ .get_or_insert_with(|| self.augment_projection_mapping(mapping));
+ if let Some(projected) = Self::project_expr_indirect(augmented, source) {
+ cls.push(projected);
+ }
+ }
// Save new constants arising from the projection:
if let Some(across) = self.is_expr_constant(source) {
for (target, _) in targets.iter() {
@@ -837,10 +857,10 @@ impl EquivalenceGroup {
.cloned()
.map(|mut cls| {
// Rows without a match on the left side are
- // padded with NULLs, so its constants no
- // longer hold.
+ // padded with NULLs, so its constants and computed
+ // equalities no longer hold.
if matches!(join_type, JoinType::Right | JoinType::Full) {
- cls.constant = None;
+ cls.null_pad();
}
cls
})
@@ -850,13 +870,13 @@ impl EquivalenceGroup {
.map(|cls| {
let mut cls = cls.try_with_offset(left_size as _)?;
// Rows without a match on the right side are
- // padded with NULLs, so its constants no
- // longer hold.
+ // padded with NULLs, so its constants and computed
+ // equalities no longer hold.
if matches!(
join_type,
JoinType::Left | JoinType::Full
) {
- cls.constant = None;
+ cls.null_pad();
}
Ok(cls)
})
diff --git a/datafusion/physical-expr/src/equivalence/properties/mod.rs b/datafusion/physical-expr/src/equivalence/properties/mod.rs
index d6ba1ef18e..467471366f 100644
--- a/datafusion/physical-expr/src/equivalence/properties/mod.rs
+++ b/datafusion/physical-expr/src/equivalence/properties/mod.rs
@@ -1298,7 +1298,8 @@ impl EquivalenceProperties {
/// # Returns
///
/// Returns an [`ExprProperties`] object containing the ordering and range
- /// information for the given expression.
+ /// information for the given expression. If its ordering is unknown, falls
+ /// back to the sort properties of an equivalent expression.
pub fn get_expr_properties(&self, expr: Arc<dyn PhysicalExpr>) -> ExprProperties {
SortKeyWalk::new(self).expr_properties(expr)
}
diff --git a/datafusion/physical-expr/src/equivalence/properties/walk.rs b/datafusion/physical-expr/src/equivalence/properties/walk.rs
index a6cab2ae39..e0487cdd23 100644
--- a/datafusion/physical-expr/src/equivalence/properties/walk.rs
+++ b/datafusion/physical-expr/src/equivalence/properties/walk.rs
@@ -104,7 +104,17 @@ impl<'a> SortKeyWalk<'a> {
/// group.
fn pin_key(&mut self, key: Arc<dyn PhysicalExpr>) -> Result<()> {
let mut stack = vec![key];
+ let mut visited = HashSet::new();
while let Some(expr) = stack.pop() {
+ if let Some(class) = self.props.eq_group.get_equivalence_class(&expr) {
+ for equivalent in class.iter() {
+ if !equivalent.children().is_empty()
+ && visited.insert(Arc::clone(equivalent))
+ {
+ stack.push(Arc::clone(equivalent));
+ }
+ }
+ }
let properties = self.expr_properties(Arc::clone(&expr));
if properties.strictly_order_preserving {
for child in expr.children() {
@@ -175,6 +185,25 @@ impl<'a> SortKeyWalk<'a> {
/// Returns the properties of `expr` among the rows that tie on the
/// pinned expressions.
pub(super) fn expr_properties(&self, expr: Arc<dyn PhysicalExpr>) -> ExprProperties {
+ let class = self.props.eq_group.get_equivalence_class(&expr);
+ let mut properties = self.expr_properties_from_tree(expr);
+ if properties.sort_properties != SortProperties::Unordered {
+ return properties;
+ }
+ if let Some(class) = class {
+ for equivalent in class.iter() {
+ let equivalent_properties =
+ self.expr_properties_from_tree(Arc::clone(equivalent));
+ if equivalent_properties.sort_properties != SortProperties::Unordered {
+ properties.sort_properties = equivalent_properties.sort_properties;
+ return properties;
+ }
+ }
+ }
+ properties
+ }
+
+ fn expr_properties_from_tree(&self, expr: Arc<dyn PhysicalExpr>) -> ExprProperties {
ExprPropertiesNode::new_unknown(expr)
.transform_up(|node| self.update_properties(node))
.data()
diff --git a/datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs b/datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs
index e05e8242b1..a821c0e49c 100644
--- a/datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs
+++ b/datafusion/physical-optimizer/src/ensure_requirements/enforce_sorting/sort_pushdown.rs
@@ -311,11 +311,16 @@ fn pushdown_sorts_helper(
sort_ordering.clone().into(),
parent_requirement.first().clone(),
);
- sort_push_down.data.ordering_requirement = if current_is_stricter {
- Some(OrderingRequirements::from(sort_ordering))
- } else {
- Some(parent_requirement)
- };
+ // A fetched sort selects rows using its own keys. Even if those
+ // keys satisfy the parent ordering, replacing them with a weaker
+ // ordering can change which rows survive (e.g. a lossy cast can
+ // introduce ties). Keep the selection keys in that case.
+ sort_push_down.data.ordering_requirement =
+ if current_is_stricter || (sort_fetch.is_some() && satisfy_parent) {
+ Some(OrderingRequirements::from(sort_ordering))
+ } else {
+ Some(parent_requirement)
+ };
// Recursive call to helper, so it doesn't transform_down and miss
// the new node (previous child of sort):
return pushdown_sorts_helper(sort_push_down);
diff --git a/datafusion/physical-plan/src/repartition/mod.rs b/datafusion/physical-plan/src/repartition/mod.rs
index 987412fe07..0ecea79ef4 100644
--- a/datafusion/physical-plan/src/repartition/mod.rs
+++ b/datafusion/physical-plan/src/repartition/mod.rs
@@ -2187,15 +2187,14 @@ impl RepartitionExec {
input: &Arc<dyn ExecutionPlan>,
preserve_order: bool,
) -> EquivalenceProperties {
- // Equivalence Properties
let mut eq_properties = input.equivalence_properties().clone();
- // If the ordering is lost, reset the ordering equivalence class:
- if !Self::maintains_input_order_helper(input, preserve_order)[0] {
- eq_properties.clear_orderings();
- }
- // When there are more than one input partitions, they will be fused at the output.
- // Therefore, remove per partition constants.
+ // Fusing several input partitions keeps only the merge key ordering,
+ // and per-partition constants no longer hold.
if input.output_partitioning().partition_count() > 1 {
+ eq_properties.clear_orderings();
+ if preserve_order && let Some(ordering) = input.output_ordering() {
+ eq_properties.add_ordering(ordering.clone());
+ }
eq_properties.clear_per_partition_constants();
}
eq_properties
diff --git a/datafusion/sqllogictest/test_files/equivalence_properties.slt b/datafusion/sqllogictest/test_files/equivalence_properties.slt
index 4b32ba2c05..735c5bc40f 100644
--- a/datafusion/sqllogictest/test_files/equivalence_properties.slt
+++ b/datafusion/sqllogictest/test_files/equivalence_properties.slt
@@ -134,6 +134,133 @@ SELECT l.c, s.x FROM (SELECT c FROM t) l CROSS JOIN (SELECT x FROM small WHERE x
1 1
2 1
+###
+### Equal expressions need not be injective
+###
+
+# c = abs(a) transfers ordering to abs(a), but equal c values do not pin
+# down a. The sort on b must remain for the two rows with c = 1.
+statement ok
+set datafusion.execution.target_partitions = 1;
+
+query I
+COPY (VALUES (-1, 2, 1), (1, 1, 1))
+TO 'test_files/scratch/equivalence_properties/abs.csv'
+OPTIONS ('format.has_header' 'true');
+----
+2
+
+statement ok
+CREATE EXTERNAL TABLE abs_equivalence (a INT, b INT, c INT)
+STORED AS CSV
+WITH ORDER (a, b)
+WITH ORDER (c)
+LOCATION 'test_files/scratch/equivalence_properties/abs.csv'
+OPTIONS ('format.has_header' 'true');
+
+query III
+SELECT a, b, c FROM abs_equivalence WHERE c = abs(a) ORDER BY c, b;
+----
+1 1 1
+-1 2 1
+
+statement ok
+DROP TABLE abs_equivalence;
+
+###
+### Projection equalities and TopK
+###
+
+# Independent volatile calls must keep the outer sort above the inner TopK.
+statement ok
+set datafusion.execution.target_partitions = 1;
+
+query TT
+EXPLAIN SELECT r, x FROM (
+ SELECT random() AS r, CAST(random() AS FLOAT) AS x
+ FROM generate_series(1, 2000) ORDER BY r LIMIT 1000
+) ORDER BY x;
+----
+physical_plan
+01)SortExec: expr=[x@1 ASC NULLS LAST], preserve_partitioning=[false]
+02)--SortExec: TopK(fetch=1000), expr=[r@0 ASC NULLS LAST], preserve_partitioning=[false]
+03)----ProjectionExec: expr=[random() as r, CAST(random() AS Float32) as x]
+04)------LazyMemoryExec: partitions=1, batch_generators=[generate_series: start=1, end=2000, batch_size=8192]
+
+# A deterministic cast is a valid equality, but can introduce ties. The
+# inner TopK must still select by r, even though its output is ordered by x.
+statement ok
+CREATE TABLE lossy_topk AS VALUES (16777217), (16777216);
+
+query IR
+SELECT r, x FROM (
+ SELECT column1 AS r, CAST(column1 AS FLOAT) AS x FROM lossy_topk
+ ORDER BY r LIMIT 1
+) ORDER BY x;
+----
+16777216 16777216
+
+statement ok
+DROP TABLE lossy_topk;
+
+statement ok
+set datafusion.execution.target_partitions = 4;
+
+###
+### Outer join NULL padding invalidates computed equalities
+###
+
+statement ok
+set datafusion.execution.target_partitions = 1;
+
+statement ok
+CREATE TABLE padded_l(k INT) AS VALUES (1), (2), (3);
+
+statement ok
+CREATE TABLE padded_r(k INT, a INT) AS VALUES (1, 1), (2, 2);
+
+# On the unmatched row, rr.x is NULL but the CASE expression is 0.
+# Their input equality must not remove the outer sort.
+query I
+SELECT y FROM (
+ SELECT CASE WHEN a IS NULL THEN 0 ELSE a END AS y FROM (
+ SELECT rr.x, rr.a
+ FROM (SELECT k, a, CASE WHEN a IS NULL THEN 0 ELSE a END AS x FROM padded_r) rr
+ RIGHT JOIN padded_l ON padded_l.k = rr.k
+ ORDER BY rr.x LIMIT 100
+ )
+) ORDER BY y;
+----
+0
+1
+2
+
+# The filter-derived equality from #26036 is also invalid on padded rows.
+statement ok
+CREATE TABLE padded_filter(a INT, b INT) AS VALUES (2, 2), (3, 3), (5, 5), (6, 6), (7, 7), (8, 8);
+
+query III
+SELECT padded_l.k, rr.a, rr.b FROM padded_l
+LEFT JOIN (SELECT a, b FROM padded_filter WHERE b = coalesce(a, 0)) rr
+ON padded_l.k = rr.b
+ORDER BY coalesce(rr.a, 0), padded_l.k;
+----
+1 NULL NULL
+2 2 2
+3 3 3
+
+statement ok
+DROP TABLE padded_filter;
+
+statement ok
+DROP TABLE padded_l;
+
+statement ok
+DROP TABLE padded_r;
+
+statement ok
+set datafusion.execution.target_partitions = 4;
+
###
### Functions whose ordering cannot be derived from their input
###
@@ -235,6 +362,19 @@ physical_plan
05)--------RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=1, maintains_sort_order=true
06)----------StreamingTableExec: partition_sizes=1, projection=[a, b, c], infinite_source=true, output_ordering=[a@0 ASC NULLS LAST, b@1 ASC NULLS LAST, c@2 ASC NULLS LAST]
+# Strictly increasing functions also retain their derived ordering after merging.
+query TT
+EXPLAIN SELECT a, x, SUM(c) OVER (PARTITION BY x ORDER BY b) s
+FROM (SELECT to_unixtime(a) x, a, b, c FROM t_inf);
+----
+physical_plan
+01)ProjectionExec: expr=[a@1 as a, x@0 as x, sum(t_inf.c) PARTITION BY [x] ORDER BY [t_inf.b ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@4 as s]
+02)--BoundedWindowAggExec: wdw=[sum(t_inf.c) PARTITION BY [x] ORDER BY [t_inf.b ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW: Field { "sum(t_inf.c) PARTITION BY [x] ORDER BY [t_inf.b ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW": nullable Int64 }, frame: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW], mode=[Sorted]
+03)----RepartitionExec: partitioning=Hash([x@0], 2), input_partitions=2, preserve_order=true, sort_exprs=a@1 ASC NULLS LAST, b@2 ASC NULLS LAST, c@3 ASC NULLS LAST, x@0 ASC NULLS LAST
+04)------ProjectionExec: expr=[to_unixtime(a@0) as x, a@0 as a, b@1 as b, c@2 as c]
+05)--------RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=1, maintains_sort_order=true
+06)----------StreamingTableExec: partition_sizes=1, projection=[a, b, c], infinite_source=true, output_ordering=[a@0 ASC NULLS LAST, b@1 ASC NULLS LAST, c@2 ASC NULLS LAST]
+
statement ok
set datafusion.execution.target_partitions = 4;
diff --git a/datafusion/sqllogictest/test_files/monotonic_projection_test.slt b/datafusion/sqllogictest/test_files/monotonic_projection_test.slt
index 9145eb3069..5e7c5360cf 100644
--- a/datafusion/sqllogictest/test_files/monotonic_projection_test.slt
+++ b/datafusion/sqllogictest/test_files/monotonic_projection_test.slt
@@ -276,6 +276,14 @@ SELECT k, cast(v as float) v_ FROM t2_int_float ORDER BY v_ DESC, k DESC;
2 16777216
1 16777216
+# Retaining v lets projection record v_ = CAST(v AS FLOAT). Equal v_ values
+# still do not imply equal v values: the suffix key must be sorted again.
+query IIR
+SELECT k, v, cast(v as float) v_ FROM t1_int_float ORDER BY v_ DESC, k DESC;
+----
+2 16777216 16777216
+1 16777217 16777216
+
# Widening cast (Int32 -> Int64) is strictly 1-to-1, so the optimizer CAN
# legally reuse the pre-existing sort order and omit a SortExec.
statement ok
diff --git a/datafusion/sqllogictest/test_files/order.slt b/datafusion/sqllogictest/test_files/order.slt
index 0d53180219..d00b437053 100644
--- a/datafusion/sqllogictest/test_files/order.slt
+++ b/datafusion/sqllogictest/test_files/order.slt
@@ -2315,6 +2315,30 @@ physical_plan
02)--SortPreservingMergeExec: [a@0 ASC NULLS LAST], fetch=10
03)----DataSourceExec: file_groups={2 groups: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/order/spm_orderings/1.csv], [WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/order/spm_orderings/2.csv]]}, projection=[a, b], limit=10, output_orderings=[[a@0 ASC NULLS LAST], [b@1 ASC NULLS LAST]], file_type=csv, has_header=true
+# An order-preserving RepartitionExec also only guarantees its merge key
+# ordering. Grouping by both columns merges on [a, b], so ORDER BY b still
+# needs a sort even though each input file is individually sorted by b.
+# https://github.com/apache/datafusion/issues/26745
+statement ok
+SET datafusion.optimizer.prefer_existing_sort = true;
+
+statement ok
+SET datafusion.optimizer.repartition_file_scans = false;
+
+query III
+SELECT a, b, count(*) FROM spm_orderings GROUP BY a, b ORDER BY b;
+----
+1 1 1
+3 2 1
+1 10 1
+2 20 1
+
+statement ok
+RESET datafusion.optimizer.prefer_existing_sort;
+
+statement ok
+RESET datafusion.optimizer.repartition_file_scans;
+
statement ok
DROP TABLE spm_orderings;
diff --git a/datafusion/sqllogictest/test_files/push_down_filter_regression.slt b/datafusion/sqllogictest/test_files/push_down_filter_regression.slt
index 8d18fb6430..bca5361a6d 100644
--- a/datafusion/sqllogictest/test_files/push_down_filter_regression.slt
+++ b/datafusion/sqllogictest/test_files/push_down_filter_regression.slt
@@ -585,9 +585,9 @@ EXPLAIN SELECT a, b, cnt FROM (
physical_plan
01)FilterExec: cnt@2 = 2
02)--ProjectionExec: expr=[a@0 as a, b@1 as b, count(agg_filter_pushdown.b)@2 as cnt]
-03)----AggregateExec: mode=FinalPartitioned, gby=[a@0 as a, b@1 as b], aggr=[count(agg_filter_pushdown.b)]
+03)----AggregateExec: mode=FinalPartitioned, gby=[a@0 as a, b@1 as b], aggr=[count(agg_filter_pushdown.b)], group_clustering_mode=Partial([1])
04)------RepartitionExec: partitioning=Hash([a@0, b@1], 4), input_partitions=4
-05)--------AggregateExec: mode=Partial, gby=[a@0 as a, b@1 as b], aggr=[count(agg_filter_pushdown.b)]
+05)--------AggregateExec: mode=Partial, gby=[a@0 as a, b@1 as b], aggr=[count(agg_filter_pushdown.b)], group_clustering_mode=Partial([1])
06)----------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
07)------------DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/push_down_filter_regression/agg_filter_pushdown.parquet]]}, projection=[a, b], file_type=parquet, predicate=b@1 = CAST(foo AS Utf8View), pruning_predicate=b_null_count@2 != row_count@3 AND b_min@0 <= foo AND foo <= b_max@1, required_guarantees=[]
diff --git a/datafusion/sqllogictest/test_files/window.slt b/datafusion/sqllogictest/test_files/window.slt
index d81bdbddcf..297899be8b 100644
--- a/datafusion/sqllogictest/test_files/window.slt
+++ b/datafusion/sqllogictest/test_files/window.slt
@@ -3336,7 +3336,7 @@ logical_plan
physical_plan
01)ProjectionExec: expr=[sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.a, annotated_data_infinite2.b] ORDER BY [annotated_data_infinite2.c ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@3 as sum1, sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.b, annotated_data_infinite2.a] ORDER BY [annotated_data_infinite2.c ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@5 as sum2, sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.a, annotated_data_infinite2.d] ORDER BY [annotated_data_infinite2.b ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@4 as sum3, sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.d] ORDER BY [annotated_data_infinite2.a ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@6 as sum4]
02)--BoundedWindowAggExec: wdw=[sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.d] ORDER BY [annotated_data_infinite2.a ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW: Field { "sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.d] ORDER BY [annotated_data_infinite2.a ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW": nullable Int64 }, frame: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW], mode=[Linear]
-03)----RepartitionExec: partitioning=Hash([d@2], 2), input_partitions=2, preserve_order=true, sort_exprs=__common_expr_1@0 ASC NULLS LAST, a@1 ASC NULLS LAST
+03)----RepartitionExec: partitioning=Hash([d@2], 2), input_partitions=2, preserve_order=true, sort_exprs=a@1 ASC NULLS LAST
04)------ProjectionExec: expr=[__common_expr_1@0 as __common_expr_1, a@1 as a, d@4 as d, sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.a, annotated_data_infinite2.b] ORDER BY [annotated_data_infinite2.c ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@5 as sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.a, annotated_data_infinite2.b] ORDER BY [annotated_data_infinite2.c ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.a, annotated_data_infinite2.d] ORDER BY [annotated_data_infinite2.b ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@6 as sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.a, annotated_data_infinite2.d] ORDER BY [annotated_data_infinite2.b ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.b, annotated_data_infinite2.a] ORDER BY [annotated_data_infinite2.c ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW@7 as sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.b, annotated_data_infinite2.a] ORDER BY [annotated_data_infinite2.c ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW]
05)--------BoundedWindowAggExec: wdw=[sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.b, annotated_data_infinite2.a] ORDER BY [annotated_data_infinite2.c ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW: Field { "sum(annotated_data_infinite2.a) PARTITION BY [annotated_data_infinite2.b, annotated_data_infinite2.a] ORDER BY [annotated_data_infinite2.c ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW": nullable Int64 }, frame: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW], mode=[Sorted]
06)----------RepartitionExec: partitioning=Hash([b@2, a@1], 2), input_partitions=2, preserve_order=true, sort_exprs=a@1 ASC NULLS LAST, b@2 ASC NULLS LAST, c@3 ASC NULLS LAST, __common_expr_1@0 ASC NULLS LAST