Class PruneCorrelatedJoinColumns

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

public class PruneCorrelatedJoinColumns extends ProjectOffPushDownRule<CorrelatedJoinNode>
This rule restricts the outputs of CorrelatedJoinNode's input and subquery based on which CorrelatedJoinNode's output symbols are referenced.

A symbol from input can be pruned, when - it is not a referenced output symbol, - it is not a correlation symbol, - it is not present in join filter.

A symbol from subquery can be pruned, when - it is not a referenced output symbol, - it is not present in join filetr.

Note: this rule does not remove any symbols from the correlation list. This is responsibility of PruneCorrelatedJoinCorrelation rule.

Transforms:

 - Project (a, c)
      - CorrelatedJoin
          correlation: [corr]
          filter: a > d
          - Input (a, b, corr)
          - Subquery (c, d, e)
 
Into:
 - Project (a, c)
      - CorrelatedJoin
          correlation: [corr]
          filter: a > d
          - Project (a, corr)
              - Input (a, b, corr)
          - Project (c, d)
              - Subquery (c, d, e)