You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Konstantin Orlov (Jira)" <ji...@apache.org> on 2021/05/05 07:48:00 UTC
[jira] [Created] (CALCITE-4596) RelFieldTrimmer#trimFields fails if
values row type is empty record
Konstantin Orlov created CALCITE-4596:
-----------------------------------------
Summary: 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
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.3.4#803005)