[
https://issues.apache.org/jira/browse/CALCITE-4596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yu Xu reassigned CALCITE-4596:
------------------------------
Assignee: Yu Xu
> RelFieldTrimmer#trimFields fails if values row type is empty record
> -------------------------------------------------------------------
>
> Key: CALCITE-4596
> URL: https://issues.apache.org/jira/browse/CALCITE-4596
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.26.0
> Reporter: Konstantin Orlov
> Assignee: Yu Xu
> Priority: Major
>
> 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.
> {code:java}
> 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);
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)