This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new 2ef8069a20 [fix](nereids) fix multi window projection issue temporarily (#24568) 2ef8069a20 is described below commit 2ef8069a20595e70e73c8bd1fe2723a987250b68 Author: xzj7019 <131111794+xzj7...@users.noreply.github.com> AuthorDate: Tue Sep 19 23:24:41 2023 +0800 [fix](nereids) fix multi window projection issue temporarily (#24568) --- .../glue/translator/PhysicalPlanTranslator.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java index 9211cb78f8..8099c81cf6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java @@ -285,6 +285,23 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla keys.addAll(validOutputIds); validOutputIds = keys; } + if (inputFragment instanceof MultiCastPlanFragment) { + // TODO: remove this logic when we split to multi-window in logical window to physical window conversion + MultiCastDataSink multiCastDataSink = (MultiCastDataSink) inputFragment.getSink(); + DataStreamSink dataStreamSink = multiCastDataSink.getDataStreamSinks().get( + multiCastDataSink.getDataStreamSinks().size() - 1); + if (!(distribute.child() instanceof PhysicalProject)) { + List<Expr> projectionExprs = new ArrayList<>(); + PhysicalCTEConsumer consumer = getCTEConsumerChild(distribute); + Preconditions.checkState(consumer != null, "consumer not found"); + for (Slot slot : distribute.getOutput()) { + projectionExprs.add(ExpressionTranslator.translate(consumer.getProducerSlot(slot), context)); + } + TupleDescriptor projectionTuple = generateTupleDesc(distribute.getOutput(), null, context); + dataStreamSink.setProjections(projectionExprs); + dataStreamSink.setOutputTupleDesc(projectionTuple); + } + } DataPartition dataPartition = toDataPartition(distribute.getDistributionSpec(), validOutputIds, context); PlanFragment parentFragment = new PlanFragment(context.nextFragmentId(), exchangeNode, dataPartition); exchangeNode.setNumInstances(inputFragment.getPlanRoot().getNumInstances()); @@ -2298,4 +2315,16 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla return dataType instanceof ArrayType || dataType instanceof MapType || dataType instanceof JsonType || dataType instanceof StructType; } + + private PhysicalCTEConsumer getCTEConsumerChild(PhysicalPlan root) { + if (root == null) { + return null; + } else if (root instanceof PhysicalCTEConsumer) { + return (PhysicalCTEConsumer) root; + } else if (root.children().size() != 1) { + return null; + } else { + return getCTEConsumerChild((PhysicalPlan) root.child(0)); + } + } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org