This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new 8360e3f6cf6 [fix](sleep) sleep with character const make be crash (#37681) (#37775) 8360e3f6cf6 is described below commit 8360e3f6cf6a559300da7eb31ae6ae477a2aba98 Author: camby <camby...@tencent.com> AuthorDate: Mon Jul 15 14:57:46 2024 +0800 [fix](sleep) sleep with character const make be crash (#37681) (#37775) cherry-pick #37681 to branch-2.1 --- 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: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org