Class RelFieldTrimmer.TrimResult

java.lang.Object
org.apache.calcite.util.Pair<RelNode,Mapping>
org.apache.calcite.sql2rel.RelFieldTrimmer.TrimResult
All Implemented Interfaces:
Serializable, Comparable<Pair<RelNode,Mapping>>, Map.Entry<RelNode,Mapping>
Enclosing class:
RelFieldTrimmer

protected static class RelFieldTrimmer.TrimResult extends Pair<RelNode,Mapping>
Result of an attempt to trim columns from a relational expression.

The mapping describes where to find the columns wanted by the parent of the current relational expression.

The mapping is a Mappings.SourceMapping, which means that no column can be used more than once, and some columns are not used. columnsUsed.getSource(i) returns the source of the i'th output field.

For example, consider the mapping for a relational expression that has 4 output columns but only two are being used. The mapping {2 → 1, 3 → 0} would give the following behavior:

  • columnsUsed.getSourceCount() returns 4
  • columnsUsed.getTargetCount() returns 2
  • columnsUsed.getSource(0) returns 3
  • columnsUsed.getSource(1) returns 2
  • columnsUsed.getSource(2) throws IndexOutOfBounds
  • columnsUsed.getTargetOpt(3) returns 0
  • columnsUsed.getTargetOpt(0) returns -1
See Also:
  • Constructor Details

    • TrimResult

      public TrimResult(RelNode left, Mapping right)
      Creates a TrimResult.
      Parameters:
      left - New relational expression
      right - Mapping of fields onto original fields