From 92e9cacf302d8fcafdc46c6a9d968b8f34d8df4b Mon Sep 17 00:00:00 2001 From: Mryange <59914473+Mryange@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:24:08 +0800 Subject: [PATCH] [opt](function) Avoid create_column inside cast_column function (#41775) ## Proposed changes In the cast function, we don't need to initialize the result column. --- be/src/vec/common/schema_util.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/be/src/vec/common/schema_util.cpp b/be/src/vec/common/schema_util.cpp index c0b48e01307012..adaee6e9fe6a5d 100644 --- a/be/src/vec/common/schema_util.cpp +++ b/be/src/vec/common/schema_util.cpp @@ -148,8 +148,7 @@ bool is_conversion_required_between_integers(const TypeIndex& lhs, const TypeInd } Status cast_column(const ColumnWithTypeAndName& arg, const DataTypePtr& type, ColumnPtr* result) { - ColumnsWithTypeAndName arguments { - arg, {type->create_column_const_with_default_value(1), type, type->get_name()}}; + ColumnsWithTypeAndName arguments {arg, {nullptr, type, type->get_name()}}; auto function = SimpleFunctionFactory::instance().get_function("CAST", arguments, type); if (!function) { return Status::InternalError("Not found cast function {} to {}", arg.type->get_name(),