Class PruneExchangeColumns

java.lang.Object
io.trino.sql.planner.iterative.rule.ProjectOffPushDownRule<ExchangeNode>
io.trino.sql.planner.iterative.rule.PruneExchangeColumns
All Implemented Interfaces:
Rule<ProjectNode>

public class PruneExchangeColumns extends ProjectOffPushDownRule<ExchangeNode>
This rule restricts the outputs of ExchangeNode based on which ExchangeNode's output symbols are either referenced by the parent node or used for partitioning, ordering or as a hash symbol by the ExchangeNode.

For each symbol removed from the output symbols list, the corresponding input symbols are removed from ExchangeNode's inputs lists.

Transforms:

 - Project (o1)
      - Exchange:
        outputs [o1, o2, o3, h]
        partitioning by (o2)
        hash h
        inputs [[a1, a2, a3, h1], [b1, b2, b3, h2]]
          - source [a1, a2, a3, h1]
          - source [b1, b2, b3, h2]
 
Into:
 - Project (o1)
      - Exchange:
        outputs [o1, o2, h]
        partitioning by (o2)
        hash h
        inputs [[a1, a2, h1], [b1, b2, h2]]
          - source [a1, a2, a3, h1]
          - source [b1, b2, b3, h2]