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

morrysnow pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 2537c1db63 [fix](planner)fix bug of push down conjuncts through agg 
and unexpected nest loop join (#22204)
2537c1db63 is described below

commit 2537c1db63f21d56d59457086e39e1a5543a56b9
Author: starocean999 <[email protected]>
AuthorDate: Thu Jul 27 09:42:03 2023 +0800

    [fix](planner)fix bug of push down conjuncts through agg and unexpected 
nest loop join (#22204)
    
    pick from master #22202 #22236
---
 .../src/main/java/org/apache/doris/analysis/DateLiteral.java       | 7 +++++++
 .../src/main/java/org/apache/doris/planner/SingleNodePlanner.java  | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
index 598181b256..e9d08ace60 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java
@@ -261,6 +261,7 @@ public class DateLiteral extends LiteralExpr {
         } else {
             throw new AnalysisException("Error date literal type : " + type);
         }
+        analysisDone();
     }
 
     public DateLiteral(long year, long month, long day) {
@@ -271,6 +272,7 @@ public class DateLiteral extends LiteralExpr {
         this.month = month;
         this.day = day;
         this.type = ScalarType.getDefaultDateType(Type.DATE);
+        analysisDone();
     }
 
     public DateLiteral(long year, long month, long day, Type type) {
@@ -280,6 +282,7 @@ public class DateLiteral extends LiteralExpr {
         
Preconditions.checkArgument(type.getPrimitiveType().equals(Type.DATE.getPrimitiveType())
                 || 
type.getPrimitiveType().equals(Type.DATEV2.getPrimitiveType()));
         this.type = type;
+        analysisDone();
     }
 
     public DateLiteral(long year, long month, long day, long hour, long 
minute, long second) {
@@ -290,6 +293,7 @@ public class DateLiteral extends LiteralExpr {
         this.month = month;
         this.day = day;
         this.type = ScalarType.getDefaultDateType(Type.DATETIME);
+        analysisDone();
     }
 
     public DateLiteral(long year, long month, long day, long hour, long 
minute, long second, long microsecond,
@@ -303,6 +307,7 @@ public class DateLiteral extends LiteralExpr {
         this.microsecond = microsecond;
         Preconditions.checkArgument(type.isDatetimeV2());
         this.type = type;
+        analysisDone();
     }
 
     public DateLiteral(long year, long month, long day, long hour, long 
minute, long second, Type type) {
@@ -315,6 +320,7 @@ public class DateLiteral extends LiteralExpr {
         
Preconditions.checkArgument(type.getPrimitiveType().equals(Type.DATETIME.getPrimitiveType())
                 || 
type.getPrimitiveType().equals(Type.DATETIMEV2.getPrimitiveType()));
         this.type = type;
+        analysisDone();
     }
 
     public DateLiteral(LocalDateTime dateTime, Type type) {
@@ -328,6 +334,7 @@ public class DateLiteral extends LiteralExpr {
             this.second = dateTime.getSecond();
             this.microsecond = dateTime.get(ChronoField.MICRO_OF_SECOND);
         }
+        analysisDone();
     }
 
     public DateLiteral(DateLiteral other) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
index 27c01dd03b..3849a16f25 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
@@ -2051,7 +2051,7 @@ public class SingleNodePlanner {
 
         for (Expr e : candidates) {
             // Ignore predicate if one of its children is a constant.
-            if (e.getChild(0).isConstant() || e.getChild(1).isConstant()) {
+            if (e.getChild(0).isLiteral() || e.getChild(1).isLiteral()) {
                 LOG.debug("double is constant.");
                 continue;
             }
@@ -2740,7 +2740,7 @@ public class SingleNodePlanner {
                 GroupByClause groupByClause = stmt.getGroupByClause();
                 List<Expr> exprs = groupByClause.getGroupingExprs();
                 final Expr srcExpr = sourceExpr;
-                if (!exprs.stream().anyMatch(expr -> expr.comeFrom(srcExpr))) {
+                if (!exprs.contains(srcExpr) && !exprs.stream().anyMatch(expr 
-> expr.comeFrom(srcExpr))) {
                     // the sourceExpr doesn't come from any of the group by 
exprs
                     isAllSlotReferToGroupBys = false;
                     break;


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

Reply via email to