Class PruneUnnestColumns

  • All Implemented Interfaces:
    Rule<ProjectNode>

    public class PruneUnnestColumns
    extends ProjectOffPushDownRule<UnnestNode>
    Absorb pruning projection into the node. Remove any unnecessary replicate symbols and ordinality symbol. Symbol is considered unnecessary if it is: - not referenced by the parent node - not used in filter expression Note: mappings are not eligible for pruning.

    Transforms:

      - Project (c)
          - Unnest:
              replicate (a, b, c, d)
              mappings (d -> d1)
              ordinality (ord)
              filter (a > 5)
              - Source (a, b, c d)
     
    into:
      - Project (c)
          - Unnest:
              replicate (a, c)
              mappings (d -> d1)
              ordinality ()
              filter (a > 5)
              - Source (a, b, c, d)
      
    Note: If, as a result of this rule, any of source's symbols became unreferenced, it will be addressed by PruneUnnestSourceColumns rule.