This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit ae084be6495969cc4fc092027befc1d1cb99270e Author: Pxl <pxl...@qq.com> AuthorDate: Thu Dec 15 19:44:27 2022 +0800 [Bug](function) fix overflow on concat_ws (#15043) fix overflow on concat_ws --- be/src/vec/functions/function_timestamp.cpp | 13 +++++-------- be/src/vec/functions/function_utility.cpp | 4 +++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/be/src/vec/functions/function_timestamp.cpp b/be/src/vec/functions/function_timestamp.cpp index f941408dc8..a467d7da8d 100644 --- a/be/src/vec/functions/function_timestamp.cpp +++ b/be/src/vec/functions/function_timestamp.cpp @@ -17,6 +17,7 @@ #include "runtime/runtime_state.h" #include "udf/udf_internal.h" +#include "vec/columns/column_const.h" #include "vec/columns/column_nullable.h" #include "vec/columns/column_string.h" #include "vec/columns/column_vector.h" @@ -397,14 +398,10 @@ struct UnixTimeStampImpl { const ColumnNumbers& arguments, size_t result, size_t input_rows_count) { auto col_result = ColumnVector<Int32>::create(); - col_result->resize(input_rows_count); - // TODO: use a const column to store this value - auto& col_result_data = col_result->get_data(); - auto res_value = context->impl()->state()->timestamp_ms() / 1000; - for (int i = 0; i < input_rows_count; i++) { - col_result_data[i] = res_value; - } - block.replace_by_position(result, std::move(col_result)); + col_result->resize(1); + col_result->get_data()[0] = context->impl()->state()->timestamp_ms() / 1000; + auto col_const = ColumnConst::create(std::move(col_result), input_rows_count); + block.replace_by_position(result, std::move(col_const)); return Status::OK(); } }; diff --git a/be/src/vec/functions/function_utility.cpp b/be/src/vec/functions/function_utility.cpp index a42918ed08..9d529c9d01 100644 --- a/be/src/vec/functions/function_utility.cpp +++ b/be/src/vec/functions/function_utility.cpp @@ -16,6 +16,7 @@ // under the License. #include <thread> +#include "vec/columns/column_const.h" #include "vec/data_types/data_type_number.h" #include "vec/data_types/data_type_string.h" #include "vec/functions/simple_function_factory.h" @@ -103,7 +104,8 @@ public: size_t result, size_t input_rows_count) override { auto res_column = ColumnString::create(); res_column->insert_data(version.c_str(), version.length()); - block.replace_by_position(result, std::move(res_column)); + auto col_const = ColumnConst::create(std::move(res_column), input_rows_count); + block.replace_by_position(result, std::move(col_const)); return Status::OK(); } }; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org