This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch dev-1.1.2
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/dev-1.1.2 by this push:
     new 0eb51086b9 [Bugfix](inpredicate) fix in predicate in group by clause 
may cause NPE (#11886)
0eb51086b9 is described below

commit 0eb51086b98c608f5448258411aa867c5b2fa911
Author: Zhengguo Yang <[email protected]>
AuthorDate: Sun Aug 21 10:03:30 2022 +0800

    [Bugfix](inpredicate) fix in predicate in group by clause may cause NPE 
(#11886)
    
    * [bug](inpredicate) fix in predicate in group by clause may cause NPE
---
 .../java/org/apache/doris/rewrite/RewriteInPredicateRule.java     | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

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 b37377e72a..b4ec881a1b 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
@@ -54,8 +54,12 @@ public class RewriteInPredicateRule implements 
ExprRewriteRule {
         }
         InPredicate inPredicate = (InPredicate) expr;
         SlotRef slotRef;
-        if (inPredicate.contains(Subquery.class) || 
!inPredicate.isLiteralChildren() || inPredicate.isNotIn()
-                || !(inPredicate.getChild(0).unwrapExpr(false) instanceof 
SlotRef)
+        // When the select stmt contains group by, we use oriGroupingExprs to 
store the original group by statement
+        // and reset it with the rewritten groupingExpr. Therefore, 
origroupingexprs cannot be analyzed.
+        // However, in #4197, oriGroupingExprs is rewritten to fix the problem 
of constant fold.
+        // 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) {
             return expr;
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to