[Bug][Vectorized] fix timestamp(datetime) not regist right (#10525)

This commit is contained in:
Pxl
2022-07-01 07:37:44 +08:00
committed by GitHub
parent aab7dc956f
commit 7571263ed7
3 changed files with 5 additions and 9 deletions

View File

@ -137,7 +137,6 @@ struct TimeStampImpl {
template <typename DateValueType, typename ArgType>
struct DayNameImpl {
using ARG_TYPE = ArgType;
using DATE_TYPE = DateValueType;
static constexpr auto name = "dayname";
static constexpr auto max_size = MAX_DAY_NAME_LEN;
@ -158,7 +157,7 @@ struct DayNameImpl {
}
static DataTypes get_variadic_argument_types() {
if constexpr (std::is_same_v<DATE_TYPE, VecDateTimeValue>) {
if constexpr (std::is_same_v<DateValueType, VecDateTimeValue>) {
return {std::make_shared<DataTypeDateTime>()};
} else {
return {std::make_shared<DataTypeDateV2>()};
@ -169,12 +168,11 @@ struct DayNameImpl {
template <typename DateValueType, typename ArgType>
struct MonthNameImpl {
using ARG_TYPE = ArgType;
using DATE_TYPE = DateValueType;
static constexpr auto name = "monthname";
static constexpr auto max_size = MAX_MONTH_NAME_LEN;
static inline auto execute(const DATE_TYPE& dt, ColumnString::Chars& res_data, size_t& offset,
bool& is_null) {
static inline auto execute(const DateValueType& dt, ColumnString::Chars& res_data,
size_t& offset, bool& is_null) {
const auto* month_name = dt.month_name();
is_null = !dt.is_valid_date();
if (month_name == nullptr || is_null) {
@ -190,7 +188,7 @@ struct MonthNameImpl {
}
static DataTypes get_variadic_argument_types() {
if constexpr (std::is_same_v<DATE_TYPE, VecDateTimeValue>) {
if constexpr (std::is_same_v<DateValueType, VecDateTimeValue>) {
return {std::make_shared<DataTypeDateTime>()};
} else {
return {std::make_shared<DataTypeDateV2>()};

View File

@ -145,6 +145,7 @@ public:
return iter->second()->build(arguments, return_type);
}
LOG(WARNING) << fmt::format("Function signature {} is not founded", key_str);
return nullptr;
}

View File

@ -68,8 +68,6 @@ using FunctionDate =
using FunctionDateV2 =
FunctionDateOrDateTimeToSomething<DataTypeDateV2, DateImpl<DateV2Value, UInt32>>;
using FunctionTimeStamp = FunctionDateOrDateTimeToSomething<DataTypeDateTime, TimeStampImpl<Int64>>;
using FunctionTimeStampV2 =
FunctionDateOrDateTimeToSomething<DataTypeDateV2, TimeStampImpl<UInt32>>;
void register_function_to_time_function(SimpleFunctionFactory& factory) {
factory.register_function<FunctionSecond>();
@ -95,7 +93,6 @@ void register_function_to_time_function(SimpleFunctionFactory& factory) {
factory.register_function<FunctionToDaysV2>();
factory.register_function<FunctionToDateV2>();
factory.register_function<FunctionDateV2>();
factory.register_function<FunctionTimeStampV2>();
}
} // namespace doris::vectorized