This is an automated email from the ASF dual-hosted git repository.
huajianlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 068e60145e [enhancement](Nereids)ban groupPlan() pattern to avoid
misuse (#12250)
068e60145e is described below
commit 068e60145eede1026390ff5288c2d57d8f2ea30a
Author: morrySnow <[email protected]>
AuthorDate: Thu Sep 1 14:37:48 2022 +0800
[enhancement](Nereids)ban groupPlan() pattern to avoid misuse (#12250)
`groupPlan()` pattern means to find a `GroupPlan` in memo. Since we have no
`GroupPlan` in memo, it is always return nothing.
When we want write a pattern to match any GROUP, we should use `group()`.
But pattern `groupPlan` is very confusing, and easy misuse.
So, this PR ban `groupPlan()` pattern ti avoid misuse.
---
.../doris/nereids/pattern/generator/PatternGeneratorAnalyzer.java | 1 +
.../org/apache/doris/nereids/rules/exploration/join/JoinLAsscom.java | 2 +-
.../apache/doris/nereids/rules/exploration/join/JoinLAsscomProject.java | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/generator/PatternGeneratorAnalyzer.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/generator/PatternGeneratorAnalyzer.java
index eb8e6b5d98..6c5343fccb 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/generator/PatternGeneratorAnalyzer.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/pattern/generator/PatternGeneratorAnalyzer.java
@@ -76,6 +76,7 @@ public class PatternGeneratorAnalyzer {
private String doGenerate() {
Map<ClassDeclaration, Set<String>> planClassMap =
parentClassMap.entrySet().stream()
.filter(kv ->
kv.getValue().contains("org.apache.doris.nereids.trees.plans.Plan"))
+ .filter(kv -> !kv.getKey().name.equals("GroupPlan"))
.filter(kv -> !Modifier.isAbstract(kv.getKey().modifiers.mod)
&& kv.getKey() instanceof ClassDeclaration)
.collect(Collectors.toMap(kv -> (ClassDeclaration)
kv.getKey(), kv -> kv.getValue()));
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscom.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscom.java
index 5e9d173d68..65f849cd5d 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscom.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscom.java
@@ -38,7 +38,7 @@ public class JoinLAsscom extends OneExplorationRuleFactory {
*/
@Override
public Rule build() {
- return logicalJoin(logicalJoin(), groupPlan())
+ return logicalJoin(logicalJoin(), group())
.when(JoinLAsscomHelper::check)
.when(join -> join.getJoinType().isInnerJoin() ||
join.getJoinType().isLeftOuterJoin()
&& (join.left().getJoinType().isInnerJoin() ||
join.left().getJoinType().isLeftOuterJoin()))
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomProject.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomProject.java
index e6d99644af..9876ed29fd 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomProject.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomProject.java
@@ -40,7 +40,7 @@ public class JoinLAsscomProject extends
OneExplorationRuleFactory {
*/
@Override
public Rule build() {
- return logicalJoin(logicalProject(logicalJoin()), groupPlan())
+ return logicalJoin(logicalProject(logicalJoin()), group())
.when(JoinLAsscomHelper::check)
.when(join -> join.getJoinType().isInnerJoin() ||
join.getJoinType().isLeftOuterJoin()
&& (join.left().child().getJoinType().isInnerJoin() ||
join.left().child().getJoinType()
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]