This is an automated email from the ASF dual-hosted git repository.
lihaopeng 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 441966a2431 [Bug](exchange)fix the exchange not skip offset rows
(#42190)
441966a2431 is described below
commit 441966a243176d5432ac6300389bd41779e0f496
Author: zhangstar333 <[email protected]>
AuthorDate: Wed Oct 23 14:58:05 2024 +0800
[Bug](exchange)fix the exchange not skip offset rows (#42190)
before the fix, the exchange operator will return some error result.
the `set_num_rows` function will save some rows[0, length), remove
others;
but here need skip offset rows, so need skip[0,offset) rows, should use
`skip_num_rows`.
---
be/src/pipeline/exec/exchange_source_operator.cpp | 6 ++++--
regression-test/data/nereids_syntax_p0/test_limit.out | 3 +++
regression-test/suites/nereids_syntax_p0/test_limit.groovy | 5 +++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/be/src/pipeline/exec/exchange_source_operator.cpp
b/be/src/pipeline/exec/exchange_source_operator.cpp
index 666f9465cf2..844e6decd64 100644
--- a/be/src/pipeline/exec/exchange_source_operator.cpp
+++ b/be/src/pipeline/exec/exchange_source_operator.cpp
@@ -17,6 +17,7 @@
#include "exchange_source_operator.h"
+#include <cstdint>
#include <memory>
#include "pipeline/exec/operator.h"
@@ -158,9 +159,10 @@ Status ExchangeSourceOperatorX::get_block(RuntimeState*
state, vectorized::Block
local_state.num_rows_skipped += block->rows();
block->set_num_rows(0);
} else if (local_state.num_rows_skipped < _offset) {
- auto offset = _offset - local_state.num_rows_skipped;
+ int64_t offset = _offset - local_state.num_rows_skipped;
local_state.num_rows_skipped = _offset;
- block->set_num_rows(block->rows() - offset);
+ // should skip some rows
+ block->skip_num_rows(offset);
}
}
if (local_state.num_rows_returned() + block->rows() < _limit) {
diff --git a/regression-test/data/nereids_syntax_p0/test_limit.out
b/regression-test/data/nereids_syntax_p0/test_limit.out
index 5ef4497f2f1..3e83144c18b 100644
--- a/regression-test/data/nereids_syntax_p0/test_limit.out
+++ b/regression-test/data/nereids_syntax_p0/test_limit.out
@@ -5,3 +5,6 @@
-- !lmit2 --
3 7934 MILLER CLERK 7782 1982-01-23 1300.0 0.0 10
+-- !lmit3 --
+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..5688097f35f 100644
--- a/regression-test/suites/nereids_syntax_p0/test_limit.groovy
+++ b/regression-test/suites/nereids_syntax_p0/test_limit.groovy
@@ -70,4 +70,9 @@ suite("test_limit") {
qt_lmit2 """
select row_number() over(order by k6 desc) k6s, t.* from
row_number_limit_tbl t limit 1 offset 2;
"""
+
+ sql """ set parallel_pipeline_task_num = 1; """
+ qt_lmit3 """
+ select row_number() over(order by k6 desc) k6s, t.* from
row_number_limit_tbl t limit 1 offset 2;
+ """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]