Skip to content

Commit

Permalink
Call input's eqivalence_properties only in outer_partitioning computa…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
gruuya committed Feb 1, 2024
1 parent 438860d commit 40a2644
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
3 changes: 2 additions & 1 deletion datafusion/physical-plan/src/projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ impl ExecutionPlan for ProjectionExec {
let normalized_exprs = exprs
.into_iter()
.map(|expr| {
self.equivalence_properties
self.input
.equivalence_properties()
.project_expr(&expr, &self.projection_mapping)
.unwrap_or_else(|| {
Arc::new(UnKnownColumn::new(&expr.to_string()))
Expand Down
28 changes: 13 additions & 15 deletions datafusion/sqllogictest/test_files/predicates.slt
Original file line number Diff line number Diff line change
Expand Up @@ -732,22 +732,20 @@ AggregateExec: mode=SinglePartitioned, gby=[p_partkey@2 as p_partkey], aggr=[SUM
--ProjectionExec: expr=[l_extendedprice@0 as l_extendedprice, l_discount@1 as l_discount, p_partkey@2 as p_partkey, ps_suppkey@4 as ps_suppkey]
----CoalesceBatchesExec: target_batch_size=8192
------HashJoinExec: mode=Partitioned, join_type=Inner, on=[(p_partkey@2, ps_partkey@0)]
--------CoalesceBatchesExec: target_batch_size=8192
----------RepartitionExec: partitioning=Hash([p_partkey@2], 4), input_partitions=4
------------ProjectionExec: expr=[l_extendedprice@1 as l_extendedprice, l_discount@2 as l_discount, p_partkey@3 as p_partkey]
--------ProjectionExec: expr=[l_extendedprice@1 as l_extendedprice, l_discount@2 as l_discount, p_partkey@3 as p_partkey]
----------CoalesceBatchesExec: target_batch_size=8192
------------HashJoinExec: mode=Partitioned, join_type=Inner, on=[(l_partkey@0, p_partkey@0)]
--------------CoalesceBatchesExec: target_batch_size=8192
----------------RepartitionExec: partitioning=Hash([l_partkey@0], 4), input_partitions=4
------------------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
--------------------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/tpch-csv/lineitem.csv]]}, projection=[l_partkey, l_extendedprice, l_discount], has_header=true
--------------CoalesceBatchesExec: target_batch_size=8192
----------------HashJoinExec: mode=Partitioned, join_type=Inner, on=[(l_partkey@0, p_partkey@0)]
------------------CoalesceBatchesExec: target_batch_size=8192
--------------------RepartitionExec: partitioning=Hash([l_partkey@0], 4), input_partitions=4
----------------------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
------------------------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/tpch-csv/lineitem.csv]]}, projection=[l_partkey, l_extendedprice, l_discount], has_header=true
------------------CoalesceBatchesExec: target_batch_size=8192
--------------------RepartitionExec: partitioning=Hash([p_partkey@0], 4), input_partitions=4
----------------------ProjectionExec: expr=[p_partkey@0 as p_partkey]
------------------------CoalesceBatchesExec: target_batch_size=8192
--------------------------FilterExec: p_brand@1 = Brand#12 OR p_brand@1 = Brand#23
----------------------------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
------------------------------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/tpch-csv/part.csv]]}, projection=[p_partkey, p_brand], has_header=true
----------------RepartitionExec: partitioning=Hash([p_partkey@0], 4), input_partitions=4
------------------ProjectionExec: expr=[p_partkey@0 as p_partkey]
--------------------CoalesceBatchesExec: target_batch_size=8192
----------------------FilterExec: p_brand@1 = Brand#12 OR p_brand@1 = Brand#23
------------------------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
--------------------------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/tpch-csv/part.csv]]}, projection=[p_partkey, p_brand], has_header=true
--------CoalesceBatchesExec: target_batch_size=8192
----------RepartitionExec: partitioning=Hash([ps_partkey@0], 4), input_partitions=1
------------MemoryExec: partitions=1, partition_sizes=[1]
Expand Down

0 comments on commit 40a2644

Please sign in to comment.