core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java
/**
   * Trims the fields of an input relational expression.
   *
   * @param rel        Relational expression
   * @param input      Input relational expression, whose fields to trim
   * @param fieldsUsed Bitmap of fields needed by the consumer
   * @return New relational expression and its field mapping
   */
Trims the fields of an input relational expression.
@param rel        Relational expression
@param input      Input relational expression, whose fields to trim
@param fieldsUsed Bitmap of fields needed by the consumer
@return New relational expression and its field mapping
Trims the fields of an input relational expression . @param rel Relational expression @param input Input relational expression whose fields to trim @param fieldsUsed Bitmap of fields needed by the consumer @return New relational expression and its field mapping
protected TrimResult trimChild(
      RelNode rel,
      RelNode input,
      ImmutableBitSet fieldsUsed,
      Set<RelDataTypeField> extraFields) {
    Util.discard(rel);
    if (input.getClass().getName().endsWith("MedMdrClassExtentRel")) {
      fieldsUsed = ImmutableBitSet.range(input.getRowType().getFieldCount());
    }
    final ImmutableList<RelCollation> collations =
        RelMetadataQuery.collations(rel);
    for (RelCollation collation : collations) {
      for (RelFieldCollation fieldCollation : collation.getFieldCollations()) {
        fieldsUsed = fieldsUsed.set(fieldCollation.getFieldIndex());
      }
    }
    return dispatchTrimFields(input, fieldsUsed, extraFields);
  }
protected TrimResult trimChild ( RelNode rel , RelNode input , ImmutableBitSet fieldsUsed , Set < RelDataTypeField > extraFields ) { Util . discard ( rel ) ; if ( input . getClass ( ) . getName ( ) . endsWith ( "MedMdrClassExtentRel" ) ) { fieldsUsed = ImmutableBitSet . range ( input . getRowType ( ) . getFieldCount ( ) ) ; } final ImmutableList < RelCollation > collations = RelMetadataQuery . collations ( rel ) ; for ( RelCollation collation : collations ) { for ( RelFieldCollation fieldCollation : collation . getFieldCollations ( ) ) { fieldsUsed = fieldsUsed . set ( fieldCollation . getFieldIndex ( ) ) ; } } return dispatchTrimFields ( input , fieldsUsed , extraFields ) ; }
Trims the fields of an input relational expression.
Trims the fields of an input relational expression .
// MedMdrJoinRule cannot handle Join of Project of // MedMdrClassExtentRel, only naked MedMdrClassExtentRel. // So, disable trimming.