This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-1.1-lts in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.1-lts by this push: new 0500400c52 [fix](in)fix in predicate datatype mismatch after union (#14509) 0500400c52 is described below commit 0500400c52299f3544d8f3915b077d12e764a74a Author: starocean999 <40539150+starocean...@users.noreply.github.com> AuthorDate: Wed Nov 23 14:01:51 2022 +0800 [fix](in)fix in predicate datatype mismatch after union (#14509) --- .../src/main/java/org/apache/doris/analysis/Expr.java | 18 ++++++++++++++++++ .../apache/doris/rewrite/RewriteInPredicateRule.java | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java index af40e9c414..ebd221988a 100755 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java @@ -1431,6 +1431,24 @@ abstract public class Expr extends TreeNode<Expr> implements ParseNode, Cloneabl return sourceExpr.get(0).getSrcSlotRef(); } + // same as getSrcSlotRef, but choose first expr if has multiple src exprs + // only used in RewriteInPredicateRule + public SlotRef tryGetSrcSlotRef() { + SlotRef unwrapSloRef = this.unwrapSlotRef(); + if (unwrapSloRef == null) { + return null; + } + SlotDescriptor slotDescriptor = unwrapSloRef.getDesc(); + if (slotDescriptor == null) { + return null; + } + List<Expr> sourceExpr = slotDescriptor.getSourceExprs(); + if (sourceExpr == null || sourceExpr.isEmpty()) { + return unwrapSloRef; + } + return sourceExpr.get(0).tryGetSrcSlotRef(); + } + public boolean comeFrom(Expr srcExpr) { SlotRef unwrapSloRef = this.unwrapSlotRef(); if (unwrapSloRef == null) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/rewrite/RewriteInPredicateRule.java b/fe/fe-core/src/main/java/org/apache/doris/rewrite/RewriteInPredicateRule.java index b4ec881a1b..ea7996c3fc 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/rewrite/RewriteInPredicateRule.java +++ b/fe/fe-core/src/main/java/org/apache/doris/rewrite/RewriteInPredicateRule.java @@ -60,7 +60,7 @@ public class RewriteInPredicateRule implements ExprRewriteRule { // The newly added InPredicteRewriteRule requires that expr must be analyzed before being rewritten if (!inPredicate.isAnalyzed() || inPredicate.contains(Subquery.class) || !inPredicate.isLiteralChildren() || inPredicate.isNotIn() || !(inPredicate.getChild(0).unwrapExpr(false) instanceof SlotRef) - || (slotRef = inPredicate.getChild(0).getSrcSlotRef()) == null || slotRef.getColumn() == null) { + || (slotRef = inPredicate.getChild(0).tryGetSrcSlotRef()) == null || slotRef.getColumn() == null) { return expr; } Type columnType = slotRef.getColumn().getType(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org