Skip to content

Commit

Permalink
[Fix](multi catalog, nereids)Fix text file required slot bug (apache#…
Browse files Browse the repository at this point in the history
…20214)

required_slots in TFileScanRangeParams params for external hive table may be updated after FileQueryScanNode finalize. For text file, we need to use the origin required_slots in params so that the list could be updated later. Otherwise, query text file may get the following error:
[INTERNAL_ERROR]Unknown source slot descriptor, slot_id=3
  • Loading branch information
Jibing-Li authored May 30, 2023
1 parent b7a69fb commit 5c8e801
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected void initSchemaParams() throws UserException {
params.addToRequiredSlots(slotInfo);
}
setDefaultValueExprs(getTargetTable(), destSlotDescByName, params, false);
setColumnPositionMappingForTextFile();
setColumnPositionMapping();
// For query, set src tuple id to -1.
params.setSrcTupleId(-1);
}
Expand Down Expand Up @@ -167,6 +167,11 @@ public void updateRequiredSlots(PlanTranslatorContext planTranslatorContext,
slotInfo.setIsFileSlot(!getPathPartitionKeys().contains(slot.getColumn().getName()));
params.addToRequiredSlots(slotInfo);
}
// Update required slots in scanRangeLocations.
for (TScanRangeLocations location : scanRangeLocations) {
location.getScanRange().getExtScanRange().getFileScanRange()
.getParams().setRequiredSlots(params.getRequiredSlots());
}
}

@Override
Expand All @@ -184,7 +189,7 @@ protected void doFinalize() throws UserException {
createScanRangeLocations();
}

private void setColumnPositionMappingForTextFile()
private void setColumnPositionMapping()
throws UserException {
TableIf tbl = getTargetTable();
List<Integer> columnIdxs = Lists.newArrayList();
Expand Down

0 comments on commit 5c8e801

Please sign in to comment.