This is an automated email from the ASF dual-hosted git repository.
panxiaolei 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 1127aecebb0 [Bug](sink) fix wrong returned rows on parallel result
sink (#36735)
1127aecebb0 is described below
commit 1127aecebb0e897c1d1db2a606aa81baf87eaa3c
Author: Pxl <[email protected]>
AuthorDate: Tue Jun 25 10:21:40 2024 +0800
[Bug](sink) fix wrong returned rows on parallel result sink (#36735)
## Proposed changes
fix wrong returned rows on parallel result sink
---
be/src/runtime/buffer_control_block.h | 2 +-
be/src/runtime/query_statistics.h | 2 +-
regression-test/data/query_p0/dry_run/dry_run.out | 4 ++
.../suites/query_p0/dry_run/dry_run.groovy | 43 ++++++++++++++++++++++
4 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/be/src/runtime/buffer_control_block.h
b/be/src/runtime/buffer_control_block.h
index 1296f2c606b..12cbc72ff52 100644
--- a/be/src/runtime/buffer_control_block.h
+++ b/be/src/runtime/buffer_control_block.h
@@ -95,7 +95,7 @@ public:
// or some other failure.
// and the number of written rows is only needed when all things go
well.
if (_query_statistics != nullptr) {
- _query_statistics->set_returned_rows(num_rows);
+ _query_statistics->add_returned_rows(num_rows);
}
}
diff --git a/be/src/runtime/query_statistics.h
b/be/src/runtime/query_statistics.h
index 0a1c5c9f7ba..f9388f77ee2 100644
--- a/be/src/runtime/query_statistics.h
+++ b/be/src/runtime/query_statistics.h
@@ -81,7 +81,7 @@ public:
this->_scan_bytes_from_remote_storage +=
scan_bytes_from_remote_storage;
}
- void set_returned_rows(int64_t num_rows) { this->returned_rows = num_rows;
}
+ void add_returned_rows(int64_t num_rows) { this->returned_rows +=
num_rows; }
void set_max_peak_memory_bytes(int64_t max_peak_memory_bytes) {
this->max_peak_memory_bytes.store(max_peak_memory_bytes,
std::memory_order_relaxed);
diff --git a/regression-test/data/query_p0/dry_run/dry_run.out
b/regression-test/data/query_p0/dry_run/dry_run.out
new file mode 100644
index 00000000000..b2fd448b29a
--- /dev/null
+++ b/regression-test/data/query_p0/dry_run/dry_run.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !select_star --
+5
+
diff --git a/regression-test/suites/query_p0/dry_run/dry_run.groovy
b/regression-test/suites/query_p0/dry_run/dry_run.groovy
new file mode 100644
index 00000000000..19fc6e011d0
--- /dev/null
+++ b/regression-test/suites/query_p0/dry_run/dry_run.groovy
@@ -0,0 +1,43 @@
+// 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.
+
+import org.codehaus.groovy.runtime.IOGroovyMethods
+
+suite ("dry_run") {
+ sql """ DROP TABLE IF EXISTS d_table; """
+
+ sql """
+ create table d_table(
+ k1 int null,
+ k2 int not null,
+ k3 bigint null,
+ k4 varchar(100) null
+ )
+ duplicate key (k1,k2,k3)
+ distributed BY hash(k1) buckets 3
+ properties("replication_num" = "1");
+ """
+
+ sql "insert into d_table select 1,1,1,'a';"
+ sql "insert into d_table select 2,2,2,'b';"
+ sql "insert into d_table select 3,-3,null,'c';"
+ sql "insert into d_table select -4,-4,-4,'d';"
+ sql "insert into d_table(k4,k2) values('d',4);"
+
+ sql "set dry_run_query=true;"
+ qt_select_star "select * from d_table;"
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]