This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit ecbd92204d14a683d54c32eb2571b353db1d4fb5 Author: morrySnow <101034200+morrys...@users.noreply.github.com> AuthorDate: Mon Apr 8 16:04:04 2024 +0800 [fix](Nereids) variant push down not work on slot without table (#33356) --- .../functions/scalar/PushDownToProjectionFunction.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/PushDownToProjectionFunction.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/PushDownToProjectionFunction.java index 7cdd0031794..8662dffcadc 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/PushDownToProjectionFunction.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/PushDownToProjectionFunction.java @@ -60,6 +60,10 @@ public abstract class PushDownToProjectionFunction extends ScalarFunction { * Otherwise, a new SlotReference is created and added to the context. */ public static Expression rewriteToSlot(PushDownToProjectionFunction pushedFunction, SlotReference topColumnSlot) { + // push down could not work well with variant that not belong to table, so skip it. + if (!topColumnSlot.getColumn().isPresent() || !topColumnSlot.getTable().isPresent()) { + return pushedFunction; + } // rewrite to slotRef StatementContext ctx = ConnectContext.get().getStatementContext(); List<String> fullPaths = pushedFunction.collectToList(node -> node instanceof VarcharLiteral).stream() @@ -73,8 +77,8 @@ public abstract class PushDownToProjectionFunction extends ScalarFunction { boolean nullable = true; // always nullable at present SlotReference slotRef = new SlotReference(StatementScopeIdGenerator.newExprId(), topColumnSlot.getName(), topColumnSlot.getDataType(), - nullable, topColumnSlot.getQualifier(), topColumnSlot.getTable().orElse(null), - topColumnSlot.getColumn().orElse(null), Optional.of(topColumnSlot.getInternalName()), + nullable, topColumnSlot.getQualifier(), topColumnSlot.getTable().get(), + topColumnSlot.getColumn().get(), Optional.of(topColumnSlot.getInternalName()), fullPaths); ctx.addPathSlotRef(topColumnSlot, fullPaths, slotRef, pushedFunction); ctx.addSlotToRelation(slotRef, ctx.getRelationBySlot(topColumnSlot)); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org