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
commit 359e2a2343faf3816f8e05959bd49cd9f8763e38 Author: starocean999 <40539150+starocean...@users.noreply.github.com> AuthorDate: Thu Apr 27 20:04:51 2023 +0800 [fix](planner) AnalyticEvalNode should call child's getOutputTupleIds method to get the correct output tuple id (#19163) --- .../org/apache/doris/planner/AnalyticEvalNode.java | 2 +- .../test_window_function_with_project.groovy | 109 +++++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticEvalNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticEvalNode.java index bbe8ef80d0..b0c8db661c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticEvalNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticEvalNode.java @@ -81,7 +81,7 @@ public class AnalyticEvalNode extends PlanNode { AnalyticWindow analyticWindow, TupleDescriptor intermediateTupleDesc, TupleDescriptor outputTupleDesc, ExprSubstitutionMap logicalToPhysicalSmap, Expr partitionByEq, Expr orderByEq, TupleDescriptor bufferedTupleDesc) { - super(id, input.getTupleIds(), "ANALYTIC", StatisticalType.ANALYTIC_EVAL_NODE); + super(id, Lists.newArrayList(input.getOutputTupleIds()), "ANALYTIC", StatisticalType.ANALYTIC_EVAL_NODE); Preconditions.checkState(!tupleIds.contains(outputTupleDesc.getId())); // we're materializing the input row augmented with the analytic output tuple tupleIds.add(outputTupleDesc.getId()); diff --git a/regression-test/suites/correctness_p0/test_window_function_with_project.groovy b/regression-test/suites/correctness_p0/test_window_function_with_project.groovy new file mode 100644 index 0000000000..2110b847cf --- /dev/null +++ b/regression-test/suites/correctness_p0/test_window_function_with_project.groovy @@ -0,0 +1,109 @@ +// 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("test_window_function_with_project") { + sql """ + drop table if exists t_retention1; + """ + + sql """ + drop view if exists v_tes1; + """ + + sql """ + drop view if exists v_tes2; + """ + + sql """ + CREATE TABLE `t_retention1` ( + `dlsj` varchar(50) NOT NULL, + `zzjhsj` varchar(50) DEFAULT NULL, + `hzzt` varchar(50) DEFAULT NULL, + `kf` varchar(50) DEFAULT NULL, + `khssdq` varchar(50) DEFAULT NULL, + `tel` varchar(50) DEFAULT NULL, + `moshi` varchar(50) DEFAULT NULL, + `tuigqd` varchar(50) DEFAULT NULL, + `jhdlsjc` int(11) DEFAULT NULL + ) + UNIQUE KEY(`dlsj`) + DISTRIBUTED BY HASH(`dlsj`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1" + ); + """ + + sql """ + CREATE VIEW v_tes1 AS + SELECT + `dlsj` AS `dlsj`, + `zzjhsj` AS `zzjhsj`, + `hzzt` AS `hzzt`, + `kf` AS `kf`, + `khssdq` AS `khssdq`, + `tel` AS `tel`, + `moshi` AS `moshi`, + `tuigqd` AS `tuigqd`, + `jhdlsjc` AS `jhdlsjc` + FROM + `t_retention1`; + """ + + sql """ + CREATE VIEW `v_tes2` AS + SELECT + `dlsj` AS `dlsj`, + str_to_date(`zzjhsj`,'%Y-%m-%d') AS `zzjhsj`, + `hzzt` AS `hzzt`, + `kf` AS `kf`, + `khssdq` AS `khssdq`, + `tel` AS `tel`, + `moshi` AS `moshi`, + `tuigqd` AS `tuigqd`, + `jhdlsjc` AS `jhdlsjc` + FROM + `v_tes1` t_tmp_a; + """ + + sql """ + SELECT + `dlsj` AS `dlsj`, + `zzjhsj` AS `zzjhsj`, + `hzzt` AS `hzzt`, + `kf` AS `kf`, + `khssdq` AS `khssdq`, + `tel` AS `tel`, + `moshi` AS `moshi`, + `tuigqd` AS `tuigqd`, + `jhdlsjc` AS `jhdlsjc`, + multi_distinct_count(`t_tmp_a`.`tel`) OVER () AS `tel_distinct_count` + FROM + `v_tes2` t_tmp_a; + """ + + sql """ + drop table if exists t_retention1; + """ + + sql """ + drop view if exists v_tes1; + """ + + sql """ + drop view if exists v_tes2; + """ +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org