diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java index aac80b95f4..dda2ee547d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java @@ -227,10 +227,14 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor> partitionExpressions = aggregate.getPartitionExpressions(); PhysicalDistribute physicalDistribute = (PhysicalDistribute) aggregate.child(); diff --git a/regression-test/data/nereids_syntax_p0/agg_with_sort.out b/regression-test/data/nereids_syntax_p0/agg_with_sort.out new file mode 100644 index 0000000000..c92ff08e08 --- /dev/null +++ b/regression-test/data/nereids_syntax_p0/agg_with_sort.out @@ -0,0 +1,4 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select -- +0 + diff --git a/regression-test/suites/nereids_syntax_p0/agg_with_sort.groovy b/regression-test/suites/nereids_syntax_p0/agg_with_sort.groovy new file mode 100644 index 0000000000..623c3e2973 --- /dev/null +++ b/regression-test/suites/nereids_syntax_p0/agg_with_sort.groovy @@ -0,0 +1,38 @@ +// 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("agg_with_sort") { + sql "SET enable_nereids_planner=true" + sql "set enable_fallback_to_original_planner=false" + sql """ + DROP TABLE IF EXISTS tbl + """ + + sql """CREATE TABLE IF NOT EXISTS tbl (a int not null, b int not null) + DISTRIBUTED BY HASH(a) + BUCKETS 1 + PROPERTIES( + "replication_num"="1" + ) + """ + //make sure we can handle this sql pattern: + // agg -> exchange -> sort + + qt_select """ + select count(1) from (select a from tbl order by a desc) t; + """ +}