diff --git a/be/src/vec/functions/function.cpp b/be/src/vec/functions/function.cpp index 1a92f475cbdcfd..031b8e755b4887 100644 --- a/be/src/vec/functions/function.cpp +++ b/be/src/vec/functions/function.cpp @@ -353,6 +353,13 @@ bool FunctionBuilderImpl::is_date_or_datetime_or_decimal( func_return_type->is_nullable() ? ((DataTypeNullable*)func_return_type.get())->get_nested_type() : func_return_type)) || + (is_date_or_datetime(return_type->is_nullable() + ? ((DataTypeNullable*)return_type.get())->get_nested_type() + : return_type) && + is_date_v2_or_datetime_v2( + func_return_type->is_nullable() + ? ((DataTypeNullable*)func_return_type.get())->get_nested_type() + : func_return_type)) || (is_decimal(return_type->is_nullable() ? ((DataTypeNullable*)return_type.get())->get_nested_type() : return_type) && diff --git a/be/src/vec/functions/function_timestamp.cpp b/be/src/vec/functions/function_timestamp.cpp index 8e20d14f793ecf..fb2340ffaaa8f0 100644 --- a/be/src/vec/functions/function_timestamp.cpp +++ b/be/src/vec/functions/function_timestamp.cpp @@ -75,11 +75,11 @@ struct StrToDate { } static DataTypePtr get_return_type_impl(const DataTypes& arguments) { - if constexpr (IsDateType || IsDateV2Type) { - return make_nullable(std::make_shared()); + if constexpr (IsDataTypeDateTimeV2) { + // max scale + return make_nullable(std::make_shared(6)); } - //datetimev2 - return make_nullable(std::make_shared(6)); + return make_nullable(std::make_shared()); } static StringRef rewrite_specific_format(const char* raw_str, size_t str_size) { @@ -1272,8 +1272,10 @@ class FunctionOtherTypesToDateType : public IFunction { } }; -using FunctionStrToDate = FunctionOtherTypesToDateType>; -using FunctionStrToDatetime = FunctionOtherTypesToDateType>; +using FunctionStrToDate = FunctionOtherTypesToDateType>; +using FunctionStrToDatetime = FunctionOtherTypesToDateType>; +using FunctionStrToDateV2 = FunctionOtherTypesToDateType>; +using FunctionStrToDatetimeV2 = FunctionOtherTypesToDateType>; using FunctionMakeDate = FunctionOtherTypesToDateType; using FunctionDateTruncDate = FunctionOtherTypesToDateType>; using FunctionDateTruncDateV2 = FunctionOtherTypesToDateType>; @@ -1283,6 +1285,8 @@ using FunctionDateTruncDatetimeV2 = FunctionOtherTypesToDateType(); factory.register_function(); + factory.register_function(); + factory.register_function(); factory.register_function(); factory.register_function(); factory.register_function();