You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by kx...@apache.org on 2023/06/06 15:15:37 UTC
[doris] 35/36: [fix](Nereids) join condition not extract as conjunctions (#20498)
This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0-beta
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 193cf917d0813ec6eb9084e75b6475f6cc01ad34
Author: morrySnow <10...@users.noreply.github.com>
AuthorDate: Tue Jun 6 20:34:19 2023 +0800
[fix](Nereids) join condition not extract as conjunctions (#20498)
---
.../doris/nereids/rules/expression/ExpressionRewrite.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/ExpressionRewrite.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/ExpressionRewrite.java
index 3dc61bcbc7..e42f82b13f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/ExpressionRewrite.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/ExpressionRewrite.java
@@ -42,7 +42,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@@ -189,7 +188,7 @@ public class ExpressionRewrite implements RewriteRuleFactory {
for (Expression expr : hashJoinConjuncts) {
Expression newExpr = rewriter.rewrite(expr, context);
hashJoinConjunctsChanged = hashJoinConjunctsChanged || !newExpr.equals(expr);
- rewriteHashJoinConjuncts.add(newExpr);
+ rewriteHashJoinConjuncts.addAll(ExpressionUtils.extractConjunction(newExpr));
}
List<Expression> rewriteOtherJoinConjuncts = Lists.newArrayList();
@@ -197,7 +196,7 @@ public class ExpressionRewrite implements RewriteRuleFactory {
for (Expression expr : otherJoinConjuncts) {
Expression newExpr = rewriter.rewrite(expr, context);
otherJoinConjunctsChanged = otherJoinConjunctsChanged || !newExpr.equals(expr);
- rewriteOtherJoinConjuncts.add(newExpr);
+ rewriteOtherJoinConjuncts.addAll(ExpressionUtils.extractConjunction(newExpr));
}
if (!hashJoinConjunctsChanged && !otherJoinConjunctsChanged) {
@@ -233,12 +232,13 @@ public class ExpressionRewrite implements RewriteRuleFactory {
public Rule build() {
return logicalHaving().thenApply(ctx -> {
LogicalHaving<Plan> having = ctx.root;
- Set<Expression> rewrittenExpr = new HashSet<>();
ExpressionRewriteContext context = new ExpressionRewriteContext(ctx.cascadesContext);
- for (Expression e : having.getExpressions()) {
- rewrittenExpr.add(rewriter.rewrite(e, context));
+ Set<Expression> newConjuncts = ImmutableSet.copyOf(ExpressionUtils.extractConjunction(
+ rewriter.rewrite(having.getPredicate(), context)));
+ if (newConjuncts.equals(having.getConjuncts())) {
+ return having;
}
- return having.withExpressions(rewrittenExpr);
+ return having.withExpressions(newConjuncts);
}).toRule(RuleType.REWRITE_HAVING_EXPRESSION);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org