Skip to content

Commit 369e201

Browse files
kavirajkalamb
andauthored
Display: Support preserve_partitioning on SortExec physical plan. (#10153)
* Display: Support `preserve_partitioning` on SortExec physical plan. Fixes: #10138 `Display` of SortExec execution plan now support `preserve_partitioning` field Signed-off-by: Kaviraj <[email protected]> * Handle `None` case Signed-off-by: Kaviraj <[email protected]> * ran `cargo test --test sqllogictests -- --complete` Signed-off-by: Kaviraj <[email protected]> * Manual tests update Signed-off-by: Kaviraj <[email protected]> * fix `sort_spill_reservation` test case Signed-off-by: Kaviraj <[email protected]> * fix formating of test output Signed-off-by: Kaviraj <[email protected]> * INCLUDE_TPCH=true cargo test --test sqllogictests -- --complete Signed-off-by: Kaviraj <[email protected]> --------- Signed-off-by: Kaviraj <[email protected]> Co-authored-by: Andrew Lamb <[email protected]>
1 parent c23a4e0 commit 369e201

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+404
-404
lines changed

datafusion/core/src/physical_optimizer/enforce_distribution.rs

Lines changed: 54 additions & 54 deletions
Large diffs are not rendered by default.

datafusion/core/src/physical_optimizer/enforce_sorting.rs

Lines changed: 102 additions & 102 deletions
Large diffs are not rendered by default.

datafusion/core/src/physical_optimizer/projection_pushdown.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,9 +2216,9 @@ mod tests {
22162216
)?);
22172217
let initial = get_plan_string(&projection);
22182218
let expected_initial = [
2219-
"ProjectionExec: expr=[c@2 as c_from_left, b@1 as b_from_left, a@0 as a_from_left, a@5 as a_from_right, c@7 as c_from_right]",
2220-
" SymmetricHashJoinExec: mode=SinglePartition, join_type=Inner, on=[(b@1, c@2)], filter=b_left_inter@0 - 1 + a_right_inter@1 <= a_right_inter@1 + c_left_inter@2",
2221-
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2219+
"ProjectionExec: expr=[c@2 as c_from_left, b@1 as b_from_left, a@0 as a_from_left, a@5 as a_from_right, c@7 as c_from_right]",
2220+
" SymmetricHashJoinExec: mode=SinglePartition, join_type=Inner, on=[(b@1, c@2)], filter=b_left_inter@0 - 1 + a_right_inter@1 <= a_right_inter@1 + c_left_inter@2",
2221+
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
22222222
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false"
22232223
];
22242224
assert_eq!(initial, expected_initial);
@@ -2227,10 +2227,10 @@ mod tests {
22272227
ProjectionPushdown::new().optimize(projection, &ConfigOptions::new())?;
22282228

22292229
let expected = [
2230-
"SymmetricHashJoinExec: mode=SinglePartition, join_type=Inner, on=[(b_from_left@1, c_from_right@1)], filter=b_left_inter@0 - 1 + a_right_inter@1 <= a_right_inter@1 + c_left_inter@2",
2231-
" ProjectionExec: expr=[c@2 as c_from_left, b@1 as b_from_left, a@0 as a_from_left]",
2232-
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2233-
" ProjectionExec: expr=[a@0 as a_from_right, c@2 as c_from_right]",
2230+
"SymmetricHashJoinExec: mode=SinglePartition, join_type=Inner, on=[(b_from_left@1, c_from_right@1)], filter=b_left_inter@0 - 1 + a_right_inter@1 <= a_right_inter@1 + c_left_inter@2",
2231+
" ProjectionExec: expr=[c@2 as c_from_left, b@1 as b_from_left, a@0 as a_from_left]",
2232+
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2233+
" ProjectionExec: expr=[a@0 as a_from_right, c@2 as c_from_right]",
22342234
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false"
22352235
];
22362236
assert_eq!(get_plan_string(&after_optimize), expected);
@@ -2335,9 +2335,9 @@ mod tests {
23352335
)?);
23362336
let initial = get_plan_string(&projection);
23372337
let expected_initial = [
2338-
"ProjectionExec: expr=[a@5 as a, b@6 as b, c@7 as c, d@8 as d, e@9 as e, a@0 as a, b@1 as b, c@2 as c, d@3 as d, e@4 as e]",
2339-
" SymmetricHashJoinExec: mode=SinglePartition, join_type=Inner, on=[(b@1, c@2)], filter=b_left_inter@0 - 1 + a_right_inter@1 <= a_right_inter@1 + c_left_inter@2",
2340-
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2338+
"ProjectionExec: expr=[a@5 as a, b@6 as b, c@7 as c, d@8 as d, e@9 as e, a@0 as a, b@1 as b, c@2 as c, d@3 as d, e@4 as e]",
2339+
" SymmetricHashJoinExec: mode=SinglePartition, join_type=Inner, on=[(b@1, c@2)], filter=b_left_inter@0 - 1 + a_right_inter@1 <= a_right_inter@1 + c_left_inter@2",
2340+
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
23412341
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false"
23422342
];
23432343
assert_eq!(initial, expected_initial);
@@ -2346,9 +2346,9 @@ mod tests {
23462346
ProjectionPushdown::new().optimize(projection, &ConfigOptions::new())?;
23472347

23482348
let expected = [
2349-
"ProjectionExec: expr=[a@5 as a, b@6 as b, c@7 as c, d@8 as d, e@9 as e, a@0 as a, b@1 as b, c@2 as c, d@3 as d, e@4 as e]",
2350-
" SymmetricHashJoinExec: mode=SinglePartition, join_type=Inner, on=[(b@1, c@2)], filter=b_left_inter@0 - 1 + a_right_inter@1 <= a_right_inter@1 + c_left_inter@2",
2351-
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2349+
"ProjectionExec: expr=[a@5 as a, b@6 as b, c@7 as c, d@8 as d, e@9 as e, a@0 as a, b@1 as b, c@2 as c, d@3 as d, e@4 as e]",
2350+
" SymmetricHashJoinExec: mode=SinglePartition, join_type=Inner, on=[(b@1, c@2)], filter=b_left_inter@0 - 1 + a_right_inter@1 <= a_right_inter@1 + c_left_inter@2",
2351+
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
23522352
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false"
23532353
];
23542354
assert_eq!(get_plan_string(&after_optimize), expected);
@@ -2502,8 +2502,8 @@ mod tests {
25022502
ProjectionPushdown::new().optimize(projection, &ConfigOptions::new())?;
25032503

25042504
let expected = [
2505-
"RepartitionExec: partitioning=Hash([a@1, b_new@0, d_new@2], 6), input_partitions=1",
2506-
" ProjectionExec: expr=[b@1 as b_new, a@0 as a, d@3 as d_new]",
2505+
"RepartitionExec: partitioning=Hash([a@1, b_new@0, d_new@2], 6), input_partitions=1",
2506+
" ProjectionExec: expr=[b@1 as b_new, a@0 as a, d@3 as d_new]",
25072507
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
25082508
];
25092509
assert_eq!(get_plan_string(&after_optimize), expected);
@@ -2560,7 +2560,7 @@ mod tests {
25602560
let initial = get_plan_string(&projection);
25612561
let expected_initial = [
25622562
"ProjectionExec: expr=[c@2 as c, a@0 as new_a, b@1 as b]",
2563-
" SortExec: expr=[b@1 ASC,c@2 + a@0 ASC]",
2563+
" SortExec: expr=[b@1 ASC,c@2 + a@0 ASC], preserve_partitioning=[false]",
25642564
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false"
25652565
];
25662566
assert_eq!(initial, expected_initial);
@@ -2569,7 +2569,7 @@ mod tests {
25692569
ProjectionPushdown::new().optimize(projection, &ConfigOptions::new())?;
25702570

25712571
let expected = [
2572-
"SortExec: expr=[b@2 ASC,c@0 + new_a@1 ASC]",
2572+
"SortExec: expr=[b@2 ASC,c@0 + new_a@1 ASC], preserve_partitioning=[false]",
25732573
" ProjectionExec: expr=[c@2 as c, a@0 as new_a, b@1 as b]",
25742574
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false"
25752575
];
@@ -2644,10 +2644,10 @@ mod tests {
26442644

26452645
let initial = get_plan_string(&projection);
26462646
let expected_initial = [
2647-
"ProjectionExec: expr=[c@2 as c, a@0 as new_a, b@1 as b]",
2648-
" UnionExec",
2649-
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2650-
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2647+
"ProjectionExec: expr=[c@2 as c, a@0 as new_a, b@1 as b]",
2648+
" UnionExec",
2649+
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2650+
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
26512651
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false"
26522652
];
26532653
assert_eq!(initial, expected_initial);
@@ -2656,12 +2656,12 @@ mod tests {
26562656
ProjectionPushdown::new().optimize(projection, &ConfigOptions::new())?;
26572657

26582658
let expected = [
2659-
"UnionExec",
2660-
" ProjectionExec: expr=[c@2 as c, a@0 as new_a, b@1 as b]",
2661-
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2662-
" ProjectionExec: expr=[c@2 as c, a@0 as new_a, b@1 as b]",
2663-
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2664-
" ProjectionExec: expr=[c@2 as c, a@0 as new_a, b@1 as b]",
2659+
"UnionExec",
2660+
" ProjectionExec: expr=[c@2 as c, a@0 as new_a, b@1 as b]",
2661+
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2662+
" ProjectionExec: expr=[c@2 as c, a@0 as new_a, b@1 as b]",
2663+
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false",
2664+
" ProjectionExec: expr=[c@2 as c, a@0 as new_a, b@1 as b]",
26652665
" CsvExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e], has_header=false"
26662666
];
26672667
assert_eq!(get_plan_string(&after_optimize), expected);

0 commit comments

Comments
 (0)