englefly commented on code in PR #12743: URL: https://github.com/apache/doris/pull/12743#discussion_r974828862
########## fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java: ########## @@ -579,54 +578,59 @@ public PlanFragment visitPhysicalHashJoin( .map(SlotReference.class::cast) .forEach(s -> hashOutputSlotReferenceMap.put(s.getExprId(), s)); + Map<ExprId, SlotReference> leftChildOutputMap = Maps.newHashMap(); + hashJoin.child(0).getOutput().stream() + .map(SlotReference.class::cast) + .forEach(s -> leftChildOutputMap.put(s.getExprId(), s)); + Map<ExprId, SlotReference> rightChildOutputMap = Maps.newHashMap(); + hashJoin.child(1).getOutput().stream() + .map(SlotReference.class::cast) + .forEach(s -> rightChildOutputMap.put(s.getExprId(), s)); + //make intermediate tuple List<SlotDescriptor> leftIntermediateSlotDescriptor = Lists.newArrayList(); List<SlotDescriptor> rightIntermediateSlotDescriptor = Lists.newArrayList(); TupleDescriptor intermediateDescriptor = context.generateTupleDesc(); if (!hashJoin.getOtherJoinCondition().isPresent() && (joinType == JoinType.LEFT_ANTI_JOIN || joinType == JoinType.LEFT_SEMI_JOIN)) { - leftIntermediateSlotDescriptor = hashJoin.child(0).getOutput().stream() - .map(SlotReference.class::cast) - .map(s -> context.createSlotDesc(intermediateDescriptor, s)) - .collect(Collectors.toList()); + for (SlotDescriptor leftSlotDescriptor : leftSlotDescriptors) { + SlotReference sf = leftChildOutputMap.get(context.findExprId(leftSlotDescriptor.getId())); Review Comment: `sf` could be null. It is better to add a if-else to catch it. Without `if (sf == null)`, it is hard for debug, because we do not print stack trace when we catch NPE exception. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org