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

jakevin 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 934f37ee4fb [fix](Nereids): fix bugs in struct info (#27890)
934f37ee4fb is described below

commit 934f37ee4fb94c6263116fae194a1f415f236784
Author: 谢健 <jianx...@gmail.com>
AuthorDate: Sat Dec 2 15:15:20 2023 +0800

    [fix](Nereids): fix bugs in struct info (#27890)
---
 .../jobs/joinorder/hypergraph/HyperGraph.java      |  3 +-
 .../rules/exploration/mv/BuildStructInfoTest.java  | 45 ++++++++++++++++++++++
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java
index 3ffd159e14b..e8e5acd2cdd 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java
@@ -431,14 +431,13 @@ public class HyperGraph {
     private Pair<BitSet, Long> buildStructInfo(Plan plan) {
         if (plan instanceof GroupPlan) {
             Group group = ((GroupPlan) plan).getGroup();
-            buildStructInfo(group.getLogicalExpressions().get(0).getPlan());
             List<HyperGraph> childGraphs = ((GroupPlan) 
plan).getGroup().getHyperGraphs();
             if (childGraphs.size() != 0) {
                 int idx = addStructInfoNode(childGraphs);
                 return Pair.of(new BitSet(), LongBitmap.newBitmap(idx));
             }
             GroupExpression groupExpression = 
group.getLogicalExpressions().get(0);
-            buildStructInfo(groupExpression.getPlan()
+            return buildStructInfo(groupExpression.getPlan()
                     .withChildren(
                             
groupExpression.children().stream().map(GroupPlan::new).collect(Collectors.toList())));
         }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/mv/BuildStructInfoTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/mv/BuildStructInfoTest.java
new file mode 100644
index 00000000000..816186a4866
--- /dev/null
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/mv/BuildStructInfoTest.java
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.rules.exploration.mv;
+
+import org.apache.doris.nereids.jobs.joinorder.hypergraph.HyperGraph;
+import org.apache.doris.nereids.sqltest.SqlTestBase;
+import org.apache.doris.nereids.util.PlanChecker;
+
+import org.junit.jupiter.api.Test;
+
+class BuildStructInfoTest extends SqlTestBase {
+    @Test
+    void testSimpleSQL() {
+        String sql = "select * from T1, T2, T3, T4 "
+                + "where "
+                + "T1.id = T2.id and "
+                + "T2.score = T3.score and "
+                + "T3.id = T4.id";
+        PlanChecker.from(connectContext)
+                .analyze(sql)
+                .rewrite()
+                .deriveStats()
+                .matches(logicalJoin()
+                        .when(j -> {
+                            HyperGraph.toStructInfo(j);
+                            return true;
+                        }));
+
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to