Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4596

RelFieldTrimmer#trimFields fails if values row type is empty record

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.26.0
    • None
    • core
    • None

    Description

      Currently an exception is thrown when LogicalValues having no fields is passed to RelFieldTrimmer#trimFields(LogicalValues, ImmutableBitSet, Set<RelDataTypeField>).

      The reason is while trying to avoid producing an empty record, the code below is not expecting the row type of the input could be already an empty record.

        public TrimResult trimFields(
            LogicalValues values,
            ImmutableBitSet fieldsUsed,
            Set<RelDataTypeField> extraFields) {
          final RelDataType rowType = values.getRowType();
          final int fieldCount = rowType.getFieldCount();
      
          // If they are asking for no fields, we can't give them what they want,
          // because zero-column records are illegal. Give them the last field,
          // which is unlikely to be a system field.
          if (fieldsUsed.isEmpty()) {
            fieldsUsed = ImmutableBitSet.range(fieldCount - 1, fieldCount);
          }
      

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              korlov Konstantin Orlov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: