[fix](planner) Slots in the cojuncts of table function node didn't got materialized #17460

This commit is contained in:
AKIRA
2023-03-07 09:50:33 +09:00
committed by GitHub
parent bc48cbff83
commit aedbc5fcb1
3 changed files with 49 additions and 0 deletions

View File

@ -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;
@ -628,6 +629,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() {

View File

@ -0,0 +1,3 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --

View File

@ -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;
"""
}