core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java
/**
   * Trims unused fields from a relational expression.
   *
   * <p>We presume that all fields of the relational expression are wanted by
   * its consumer, so only trim fields that are not used within the tree.
   *
   * @param root Root node of relational expression
   * @return Trimmed relational expression
   */
Trims unused fields from a relational expression.
We presume that all fields of the relational expression are wanted by
its consumer, so only trim fields that are not used within the tree.

@param root Root node of relational expression
@return Trimmed relational expression
Trims unused fields from a relational expression . We presume that all fields of the relational expression are wanted by its consumer so only trim fields that are not used within the tree . @param root Root node of relational expression @return Trimmed relational expression
public RelNode trim(RelNode root) {
    final int fieldCount = root.getRowType().getFieldCount();
    final ImmutableBitSet fieldsUsed = ImmutableBitSet.range(fieldCount);
    final Set<RelDataTypeField> extraFields = Collections.emptySet();
    final TrimResult trimResult =
        dispatchTrimFields(root, fieldsUsed, extraFields);
    if (!trimResult.right.isIdentity()) {
      throw new IllegalArgumentException();
    }
    return trimResult.left;
  }
public RelNode trim ( RelNode root ) { final int fieldCount = root . getRowType ( ) . getFieldCount ( ) ; final ImmutableBitSet fieldsUsed = ImmutableBitSet . range ( fieldCount ) ; final Set < RelDataTypeField > extraFields = Collections . emptySet ( ) ; final TrimResult trimResult = dispatchTrimFields ( root , fieldsUsed , extraFields ) ; if ( ! trimResult . right . isIdentity ( ) ) { throw new IllegalArgumentException ( ) ; } return trimResult . left ; }
Trims unused fields from a relational expression.
Trims unused fields from a relational expression .