Class PruneApplySourceColumns

  • All Implemented Interfaces:
    Rule<ApplyNode>

    public class PruneApplySourceColumns
    extends Object
    implements Rule<ApplyNode>
    This rule restricts outputs of ApplyNode's subquery to include only the symbols needed for subqueryAssignments. Symbols from the subquery are not produced at ApplyNode's output. They are only used for the assignments. Transforms:
     - Apply
          correlation: [corr_symbol]
          assignments:
              result_1 -> a in subquery_symbol_1,
              result_2 -> b > ALL subquery_symbol_2
        - Input (a, b, corr_symbol)
        - Subquery (subquery_symbol_1, subquery_symbol_2, subquery_symbol_3)
     
    Into:
     - Apply
          correlation: [corr_symbol]
          assignments:
              result_1 -> a in subquery_symbol_1,
              result_2 -> b > ALL subquery_symbol_2
        - Input (a, b, corr_symbol)
        - Project
              subquery_symbol_1 -> subquery_symbol_1
              subquery_symbol_2 -> subquery_symbol_2
            - Subquery (subquery_symbol_1, subquery_symbol_2, subquery_symbol_3)
     
    Note: ApplyNode's input symbols are produced on ApplyNode's output. They cannot be pruned without outer context.