This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 02a7995171 [fix](planner)wrong result when has order by under join (#15974) 02a7995171 is described below commit 02a7995171b7c1bb07def9ccf2cccb1d4b5218fc Author: morrySnow <101034200+morrys...@users.noreply.github.com> AuthorDate: Tue Jan 17 20:20:56 2023 +0800 [fix](planner)wrong result when has order by under join (#15974) --- .../org/apache/doris/planner/ExchangeNode.java | 5 +-- .../query_p0/limit/OffsetInSubqueryWithJoin.groovy | 42 ++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/ExchangeNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/ExchangeNode.java index 0629af2295..d613fd9102 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/ExchangeNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/ExchangeNode.java @@ -84,9 +84,10 @@ public class ExchangeNode extends PlanNode { if (inputNode.getFragment().isPartitioned()) { limit = inputNode.limit; } - offset = inputNode.offset; + if (!(inputNode instanceof ExchangeNode)) { + offset = inputNode.offset; + } computeTupleIds(); - } public boolean isMergingExchange() { diff --git a/regression-test/suites/query_p0/limit/OffsetInSubqueryWithJoin.groovy b/regression-test/suites/query_p0/limit/OffsetInSubqueryWithJoin.groovy new file mode 100644 index 0000000000..da0c7231f4 --- /dev/null +++ b/regression-test/suites/query_p0/limit/OffsetInSubqueryWithJoin.groovy @@ -0,0 +1,42 @@ +// 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_offset_in_subquery_with_join", "query") { + // define a sql table + def testTable = "test_offset_in_subquery_with_join" + + sql """ + drop table if exists ${testTable} + """ + + sql """ + create table if not exists ${testTable}(id int) distributed by hash(id) properties('replication_num'='1') + """ + + sql """ + insert into ${testTable} values (1), (1); + """ + + test { + sql "select * from $testTable where id in (select id from $testTable order by id limit 1, 1)" + result([ + [1], + [1] + ]) + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org