This is an automated email from the ASF dual-hosted git repository. morrysnow pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 3dd0b03fa7e [fix](Nereids) offset do more than once when have shuffle after limit (#42576) (#42682) 3dd0b03fa7e is described below commit 3dd0b03fa7e3be5a3ad6e45e90c5e6d509f9cc00 Author: morrySnow <101034200+morrys...@users.noreply.github.com> AuthorDate: Tue Oct 29 14:06:43 2024 +0800 [fix](Nereids) offset do more than once when have shuffle after limit (#42576) (#42682) pick from master #42576 intro by #39316. it want to fix a problem intro by #36699. but forgot to remove all wrong code in #36699. after #39316, we should not set offset on exchange, when the exchange is on the top of a limit with offset. --- .../glue/translator/PhysicalPlanTranslator.java | 3 --- .../data/nereids_syntax_p0/test_limit.out | 6 ------ .../suites/nereids_syntax_p0/test_limit.groovy | 23 ++++++++++++++++++---- 3 files changed, 19 insertions(+), 13 deletions(-) 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 a49e210aa44..a2de45fd83b 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 @@ -324,9 +324,6 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla .collect(Collectors.toList()); keys.addAll(validOutputIds); validOutputIds = keys; - } else if (child instanceof PhysicalLimit && ((PhysicalLimit<?>) child).getPhase().isGlobal()) { - // because sort already contains Offset, we don't need to handle PhysicalTopN - exchangeNode.setOffset(((PhysicalLimit<?>) child).getOffset()); } if (inputFragment instanceof MultiCastPlanFragment) { // TODO: remove this logic when we split to multi-window in logical window to physical window conversion diff --git a/regression-test/data/nereids_syntax_p0/test_limit.out b/regression-test/data/nereids_syntax_p0/test_limit.out deleted file mode 100644 index f36542a7375..00000000000 --- a/regression-test/data/nereids_syntax_p0/test_limit.out +++ /dev/null @@ -1,6 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !limit1 -- -2 7844 TURNER SALESMAN 7698 1981-09-08 1500.0 0.0 30 - --- !lmit2 -- -3 7934 MILLER CLERK 7782 1982-01-23 1300.0 0.0 10 diff --git a/regression-test/suites/nereids_syntax_p0/test_limit.groovy b/regression-test/suites/nereids_syntax_p0/test_limit.groovy index fb24d8f1a3a..f2f044a7cda 100644 --- a/regression-test/suites/nereids_syntax_p0/test_limit.groovy +++ b/regression-test/suites/nereids_syntax_p0/test_limit.groovy @@ -34,6 +34,13 @@ suite("test_limit") { result([[1]]) } + test { + sql """ + select * from test1 t1 join (select * from test1 limit 1 offset 1) t2 + """ + result([[1,1],[1,1]]) + } + sql """ drop table if exists row_number_limit_tbl; """ @@ -57,9 +64,13 @@ suite("test_limit") { sql """ INSERT INTO row_number_limit_tbl VALUES (7788, 'SCOTT', 'ANALYST', 7566, '1987-04-19', 3000, 0, 20); """ sql """ INSERT INTO row_number_limit_tbl VALUES (7844, 'TURNER', 'SALESMAN', 7698, '1981-09-08', 1500, 0, 30); """ - qt_limit1 """ - select row_number() over(order by k6 desc) k6s, t.* from row_number_limit_tbl t order by k6s limit 1 offset 1; + + test { + sql """ + select row_number() over(order by k6 desc) k6s, t.* from row_number_limit_tbl t order by k6s limit 1 offset 1 """ + rowNum 1 + } sql """ truncate table row_number_limit_tbl; """ @@ -67,7 +78,11 @@ suite("test_limit") { sql """ INSERT INTO row_number_limit_tbl VALUES (7844, 'TURNER', 'SALESMAN', 7698, '1981-09-08', 1500, 0, 30); """ sql """ INSERT INTO row_number_limit_tbl VALUES (7934, 'MILLER', 'CLERK', 7782, '1982-01-23', 1300, 0, 10); """ - qt_lmit2 """ - select row_number() over(order by k6 desc) k6s, t.* from row_number_limit_tbl t limit 1 offset 2; + test { + sql """ + select row_number() over(order by k6 desc) k6s, t.* from row_number_limit_tbl t limit 1 offset 2 """ + rowNum 1 + } } + --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org