[Fix](planner)Fix TupleDescriptor include not materialized slot bug (#18783)

setOutputSmap function in ScanNode may include not materialized to outputTupleDesc. This PR is to fix this.
This commit is contained in:
Jibing-Li
2023-04-19 14:08:09 +08:00
committed by GitHub
parent 446db3def6
commit 1a25f110ec

View File

@ -516,7 +516,7 @@ public abstract class ScanNode extends PlanNode {
// create a tmpSmap for the later setOutputSmap call
ExprSubstitutionMap tmpSmap = new ExprSubstitutionMap(
Lists.newArrayList(outputTupleDesc.getSlots().stream().map(slot -> new SlotRef(slot)).collect(
Collectors.toList())), Lists.newArrayList(projectList));
Collectors.toList())), Lists.newArrayList(projectList));
Set<SlotId> allOutputSlotIds = outputTupleDesc.getSlots().stream().map(slot -> slot.getId())
.collect(Collectors.toSet());
List<Expr> newRhs = Lists.newArrayList();
@ -530,10 +530,14 @@ public abstract class ScanNode extends PlanNode {
slotDesc.initFromExpr(rhsExpr);
if (rhsExpr instanceof SlotRef) {
slotDesc.setSrcColumn(((SlotRef) rhsExpr).getColumn());
slotDesc.setIsMaterialized(((SlotRef) rhsExpr).getDesc().isMaterialized());
} else {
slotDesc.setIsMaterialized(true);
}
if (slotDesc.isMaterialized()) {
slotDesc.materializeSrcExpr();
projectList.add(rhsExpr);
}
slotDesc.setIsMaterialized(true);
slotDesc.materializeSrcExpr();
projectList.add(rhsExpr);
newRhs.add(new SlotRef(slotDesc));
allOutputSlotIds.add(slotDesc.getId());
} else {