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/25 14:38:02 UTC
[doris] 05/05: [fix](nereids)scan node's smap should use materiazlied slots and project list as left and right expr list (#21142)
This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
commit fe51e6ffdb99a08a5f70a72bfe4cc2a8cdc26f6c
Author: starocean999 <40...@users.noreply.github.com>
AuthorDate: Sun Jun 25 22:34:43 2023 +0800
[fix](nereids)scan node's smap should use materiazlied slots and project list as left and right expr list (#21142)
---
.../java/org/apache/doris/planner/ScanNode.java | 7 ++-
.../test_inlineview_with_project.groovy | 61 ++++++++++++++++++++++
2 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java
index 7dc0a7b3de..84b95c5a06 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java
@@ -533,8 +533,11 @@ public abstract class ScanNode extends PlanNode {
// this happens if the olap table is in the most inner sub-query block in the cascades sub-queries
// create a tmpSmap for the later setOutputSmap call
ExprSubstitutionMap tmpSmap = new ExprSubstitutionMap(
- Lists.newArrayList(outputTupleDesc.getSlots().stream().map(slot -> new SlotRef(slot)).collect(
- Collectors.toList())), Lists.newArrayList(projectList));
+ Lists.newArrayList(outputTupleDesc.getSlots().stream()
+ .filter(slot -> slot.isMaterialized())
+ .map(slot -> new SlotRef(slot))
+ .collect(Collectors.toList())),
+ Lists.newArrayList(projectList));
Set<SlotId> allOutputSlotIds = outputTupleDesc.getSlots().stream().map(slot -> slot.getId())
.collect(Collectors.toSet());
List<Expr> newRhs = Lists.newArrayList();
diff --git a/regression-test/suites/correctness_p0/test_inlineview_with_project.groovy b/regression-test/suites/correctness_p0/test_inlineview_with_project.groovy
index 6eb09cf047..a155514041 100644
--- a/regression-test/suites/correctness_p0/test_inlineview_with_project.groovy
+++ b/regression-test/suites/correctness_p0/test_inlineview_with_project.groovy
@@ -16,6 +16,7 @@
// under the License.
suite("test_inlineview_with_project") {
+ sql "set enable_nereids_planner=false"
sql """
drop table if exists cir_1756_t1;
"""
@@ -321,4 +322,64 @@ suite("test_inlineview_with_project") {
sql """
drop table if exists ods_table4;
"""
+
+ sql """
+ drop table if exists cir2824_table;
+ """
+
+ sql """
+ CREATE TABLE `cir2824_table` (
+ `id` BIGINT(20) NULL,
+ `create_user` BIGINT(20) NULL,
+ `event_content` TEXT NULL,
+ `dest_farm_id` BIGINT(20) NULL,
+ `weight` DOUBLE NULL
+ ) ENGINE=OLAP
+ UNIQUE KEY(`id`)
+ COMMENT 'OLAP'
+ DISTRIBUTED BY HASH(`id`) BUCKETS 48
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1",
+ "in_memory" = "false",
+ "storage_format" = "V2",
+ "function_column.sequence_type" = "BIGINT",
+ "disable_auto_compaction" = "false"
+ );
+ """
+
+ sql """
+ drop view if exists cir2824_view;
+ """
+
+ sql """
+ CREATE VIEW `cir2824_view` COMMENT 'VIEW' AS
+ select `ev`.`id` AS `id`,
+ CAST(`ev`.`create_user` AS BIGINT) AS `create_user`,
+ `ev`.`event_content` AS `event_content`,
+ `ev`.`dest_farm_id` AS `dest_farm_id`
+ FROM `cir2824_table` ev;
+ """
+
+ explain {
+ sql("""
+ WITH cir2824_temp1 AS( SELECT
+ CASE
+ WHEN dest_farm_id IS NULL
+ AND get_json_string(t.event_content,'\$.destFarmId') != '' THEN
+ 0
+ ELSE 1
+ END AS is_trans
+ FROM cir2824_view t )
+ SELECT 1
+ FROM cir2824_temp1;
+ """)
+ }
+
+ sql """
+ drop view if exists cir2824_view;
+ """
+
+ sql """
+ drop table if exists cir2824_table;
+ """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org