This is an automated email from the ASF dual-hosted git repository.
lide 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 ceead841c02 [fix](sleep) sleep with character const make be crash
(#37681)
ceead841c02 is described below
commit ceead841c0245d9dbc9a7b2671e63b451f437b8e
Author: camby <[email protected]>
AuthorDate: Mon Jul 15 10:39:02 2024 +0800
[fix](sleep) sleep with character const make be crash (#37681)
---
be/src/vec/functions/function_utility.cpp | 19 +++++++------------
.../suites/nereids_p0/system/test_query_sys.groovy | 1 +
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/be/src/vec/functions/function_utility.cpp
b/be/src/vec/functions/function_utility.cpp
index ea2cfe6615f..b2014345376 100644
--- a/be/src/vec/functions/function_utility.cpp
+++ b/be/src/vec/functions/function_utility.cpp
@@ -62,7 +62,7 @@ public:
size_t get_number_of_arguments() const override { return 1; }
DataTypePtr get_return_type_impl(const DataTypes& arguments) const
override {
- if (arguments[0].get()->is_nullable()) {
+ if (arguments[0]->is_nullable()) {
return make_nullable(std::make_shared<DataTypeUInt8>());
}
return std::make_shared<DataTypeUInt8>();
@@ -70,23 +70,18 @@ public:
bool use_default_implementation_for_nulls() const override { return false;
}
+ // Sleep function should not be executed during open stage, this will
makes fragment prepare
+ // waiting too long, so we do not use default impl.
bool use_default_implementation_for_constants() const override { return
false; }
Status execute_impl(FunctionContext* context, Block& block, const
ColumnNumbers& arguments,
size_t result, size_t input_rows_count) const override
{
- ColumnPtr& argument_column =
block.get_by_position(arguments[0]).column;
+ const auto& argument_column =
+
block.get_by_position(arguments[0]).column->convert_to_full_column_if_const();
auto res_column = ColumnUInt8::create();
- if (is_column_const(*argument_column)) {
- Int64 seconds = argument_column->get_int(0);
- for (int i = 0; i < input_rows_count; i++) {
- std::this_thread::sleep_for(std::chrono::seconds(seconds));
- res_column->insert(1);
- }
-
- block.replace_by_position(result, std::move(res_column));
- } else if (auto* nullable_column =
check_and_get_column<ColumnNullable>(*argument_column)) {
+ if (auto* nullable_column =
check_and_get_column<ColumnNullable>(*argument_column)) {
auto null_map_column = ColumnUInt8::create();
auto nested_column = nullable_column->get_nested_column_ptr();
@@ -154,4 +149,4 @@ void register_function_utility(SimpleFunctionFactory&
factory) {
factory.register_function<FunctionVersion>();
}
-} // namespace doris::vectorized
\ No newline at end of file
+} // namespace doris::vectorized
diff --git a/regression-test/suites/nereids_p0/system/test_query_sys.groovy
b/regression-test/suites/nereids_p0/system/test_query_sys.groovy
index df1dff9dadb..85d612b9c17 100644
--- a/regression-test/suites/nereids_p0/system/test_query_sys.groovy
+++ b/regression-test/suites/nereids_p0/system/test_query_sys.groovy
@@ -36,6 +36,7 @@ suite("test_query_sys", "query,p0") {
sql "select pi();"
sql "select e();"
sql "select sleep(2);"
+ sql "select sleep('1.1');"
// INFORMATION_SCHEMA
sql "SELECT table_name FROM INFORMATION_SCHEMA.TABLES where
table_schema=\"nereids_test_query_db\" and TABLE_TYPE = \"BASE TABLE\" order by
table_name"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]