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 565fb98aad2 [fix](functions) Fix sleep return value problem (#55926)
565fb98aad2 is described below
commit 565fb98aad2d68db1df7c28e65244bbc6db637ce
Author: dwdwqfwe <[email protected]>
AuthorDate: Sat Sep 13 19:13:14 2025 +0800
[fix](functions) Fix sleep return value problem (#55926)
### What problem does this PR solve?
Problem Summary:
To align with MySQL's behavior, the previous return results all returned
the input value, which is inconsistent with MySQL. The correct behavior
should be returning 0 when the sleep ends.
mysql behavior:
mysql> SELECT SLEEP(1000);
+-------------+
| SLEEP(1000) |
+-------------+
| 0 |
+-------------+
our behavior:
mysql> SELECT SLEEP(1000);
+-------------+
| SLEEP(1000) |
+-------------+
| 1000 |
+-------------+
after fix,our behavior:
mysql> SELECT SLEEP(1000);
+-------------+
| SLEEP(1000) |
+-------------+
| 0 |
+-------------+
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---
be/src/vec/functions/function_utility.cpp | 5 +----
.../data/nereids_function_p0/scalar_function/S.out | Bin 53833 -> 53858 bytes
.../fold_constant/fold_constant_by_be.out | Bin 222 -> 223 bytes
.../test_inject_send_filter_size_fail.out | Bin 197 -> 200 bytes
.../join/test_slow_close/test_slow_close.out | Bin 133 -> 135 bytes
5 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/be/src/vec/functions/function_utility.cpp
b/be/src/vec/functions/function_utility.cpp
index e98a1129c12..ac070d668b2 100644
--- a/be/src/vec/functions/function_utility.cpp
+++ b/be/src/vec/functions/function_utility.cpp
@@ -78,7 +78,7 @@ public:
const auto& argument_column =
block.get_by_position(arguments[0]).column->convert_to_full_column_if_const();
- auto res_column = ColumnUInt8::create();
+ auto res_column = ColumnUInt8::create(input_rows_count, 0);
if (auto* nullable_column =
check_and_get_column<ColumnNullable>(*argument_column)) {
auto null_map_column = ColumnUInt8::create();
@@ -88,12 +88,10 @@ public:
for (int i = 0; i < input_rows_count; i++) {
if (nullable_column->is_null_at(i)) {
- res_column->insert(Field::create_field<TYPE_BOOLEAN>(0));
null_map_column->insert(Field::create_field<TYPE_BOOLEAN>(1));
} else {
int seconds = data_column->get_data()[i];
std::this_thread::sleep_for(std::chrono::seconds(seconds));
- res_column->insert(Field::create_field<TYPE_BOOLEAN>(1));
null_map_column->insert(Field::create_field<TYPE_BOOLEAN>(0));
}
}
@@ -106,7 +104,6 @@ public:
for (int i = 0; i < input_rows_count; i++) {
int seconds = data_column->get_element(i);
std::this_thread::sleep_for(std::chrono::seconds(seconds));
- res_column->insert(Field::create_field<TYPE_BOOLEAN>(1));
}
block.replace_by_position(result, std::move(res_column));
diff --git a/regression-test/data/nereids_function_p0/scalar_function/S.out
b/regression-test/data/nereids_function_p0/scalar_function/S.out
index b7a63de5b41..327722addbf 100644
Binary files a/regression-test/data/nereids_function_p0/scalar_function/S.out
and b/regression-test/data/nereids_function_p0/scalar_function/S.out differ
diff --git
a/regression-test/data/nereids_p0/expression/fold_constant/fold_constant_by_be.out
b/regression-test/data/nereids_p0/expression/fold_constant/fold_constant_by_be.out
index 8d9d704684e..9f0261e4537 100644
Binary files
a/regression-test/data/nereids_p0/expression/fold_constant/fold_constant_by_be.out
and
b/regression-test/data/nereids_p0/expression/fold_constant/fold_constant_by_be.out
differ
diff --git
a/regression-test/data/query_p0/join/test_inject_send_filter_size_fail/test_inject_send_filter_size_fail.out
b/regression-test/data/query_p0/join/test_inject_send_filter_size_fail/test_inject_send_filter_size_fail.out
index 42b0346861d..6dbda5311a2 100644
Binary files
a/regression-test/data/query_p0/join/test_inject_send_filter_size_fail/test_inject_send_filter_size_fail.out
and
b/regression-test/data/query_p0/join/test_inject_send_filter_size_fail/test_inject_send_filter_size_fail.out
differ
diff --git
a/regression-test/data/query_p0/join/test_slow_close/test_slow_close.out
b/regression-test/data/query_p0/join/test_slow_close/test_slow_close.out
index 5e4d8ec9448..b38a4b938cb 100644
Binary files
a/regression-test/data/query_p0/join/test_slow_close/test_slow_close.out and
b/regression-test/data/query_p0/join/test_slow_close/test_slow_close.out differ
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]