Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions datafusion/core/src/physical_optimizer/enforce_distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3794,7 +3794,11 @@ pub(crate) mod tests {
sort_key,
projection_exec_with_alias(
filter_exec(parquet_exec()),
vec![("a".to_string(), "a".to_string())],
vec![
("a".to_string(), "a".to_string()),
("b".to_string(), "b".to_string()),
("c".to_string(), "c".to_string()),
],
),
false,
);
Expand All @@ -3803,7 +3807,7 @@ pub(crate) mod tests {
"SortPreservingMergeExec: [c@2 ASC]",
// Expect repartition on the input to the sort (as it can benefit from additional parallelism)
"SortExec: expr=[c@2 ASC]",
"ProjectionExec: expr=[a@0 as a]",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously after projection there was no column c. However, sort above refers to c, this example changes projection below so that column c is still present at the input of the Sort (All of the changes in this PR are in similar spirit).

"ProjectionExec: expr=[a@0 as a, b@1 as b, c@2 as c]",
"FilterExec: c@2 = 0",
// repartition is lowest down
"RepartitionExec: partitioning=RoundRobinBatch(10), input_partitions=1",
Expand All @@ -3815,7 +3819,7 @@ pub(crate) mod tests {
let expected_first_sort_enforcement = &[
"SortExec: expr=[c@2 ASC]",
"CoalescePartitionsExec",
"ProjectionExec: expr=[a@0 as a]",
"ProjectionExec: expr=[a@0 as a, b@1 as b, c@2 as c]",
"FilterExec: c@2 = 0",
"RepartitionExec: partitioning=RoundRobinBatch(10), input_partitions=1",
"ParquetExec: file_groups={1 group: [[x]]}, projection=[a, b, c, d, e]",
Expand Down
Loading