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

morningman 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 6b419e3fe9 [fix](planner) Slots in the cojuncts of table function node 
didn't got materialized #17460
6b419e3fe9 is described below

commit 6b419e3fe955b6f6f30c9801bd97364603ea5573
Author: AKIRA <33112463+kikyou1...@users.noreply.github.com>
AuthorDate: Tue Mar 7 09:50:33 2023 +0900

    [fix](planner) Slots in the cojuncts of table function node didn't got 
materialized #17460
---
 .../java/org/apache/doris/planner/PlanNode.java    | 11 +++++++
 .../data/query_p0/lateral_view/test_with_view.out  |  3 ++
 .../query_p0/lateral_view/test_with_view.groovy    | 35 ++++++++++++++++++++++
 3 files changed, 49 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
index 2e58a19ed3..67e0f336d0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
@@ -57,6 +57,7 @@ import org.apache.commons.collections.CollectionUtils;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -624,6 +625,16 @@ public abstract class PlanNode extends TreeNode<PlanNode> 
implements PlanStats {
         if (!analyzer.safeIsEnableJoinReorderBasedCost()) {
             computeOldCardinality();
         }
+        for (Expr expr : conjuncts) {
+            Set<SlotRef> slotRefs = new HashSet<>();
+            expr.getSlotRefsBoundByTupleIds(tupleIds, slotRefs);
+            for (SlotRef slotRef : slotRefs) {
+                slotRef.getDesc().setIsMaterialized(true);
+            }
+            for (TupleId tupleId : tupleIds) {
+                analyzer.getTupleDesc(tupleId).computeMemLayout();
+            }
+        }
     }
 
     protected void computeNumNodes() {
diff --git a/regression-test/data/query_p0/lateral_view/test_with_view.out 
b/regression-test/data/query_p0/lateral_view/test_with_view.out
new file mode 100644
index 0000000000..9c9c4c6c8a
--- /dev/null
+++ b/regression-test/data/query_p0/lateral_view/test_with_view.out
@@ -0,0 +1,3 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !sql --
+
diff --git a/regression-test/suites/query_p0/lateral_view/test_with_view.groovy 
b/regression-test/suites/query_p0/lateral_view/test_with_view.groovy
new file mode 100644
index 0000000000..e1ef938bc4
--- /dev/null
+++ b/regression-test/suites/query_p0/lateral_view/test_with_view.groovy
@@ -0,0 +1,35 @@
+// 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.
+
+suite("lateral_view_with_inline_view") {
+    sql """DROP TABLE IF EXISTS t1;"""
+    sql """CREATE TABLE t1 (col1 varchar(11451) not null, col2 int not null, 
col3 int not null, col4 int not null)
+    UNIQUE KEY(`col1`)
+    DISTRIBUTED BY HASH(col1)
+    BUCKETS 3
+    PROPERTIES(
+            "replication_num"="1"
+    );"""
+    qt_sql """
+    select example1.col1
+    from 
+    (select col1,`col4`,col2
+    from t1 where col3<=115411) 
+    example1 lateral view explode([1,2,3]) tmp1 as e1 where col4<e1;
+    """
+
+}
\ No newline at end of file


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

Reply via email to