Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
koarz committed Dec 27, 2024
1 parent 8d06dda commit 8335b3a
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions be/src/vec/functions/function_date_or_datetime_computation.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,43 +88,43 @@ ReturnNativeType date_time_add(const InputNativeType& t, Int32 delta, bool& is_n
}
}

#define ADD_TIME_FUNCTION_IMPL(CLASS, NAME, UNIT) \
template <typename ArgType> \
struct CLASS { \
/*for V2 type, if unit <= hour, increase to DatetimeV2, for V1 same as V2 version*/ \
using ReturnType = std::conditional_t< \
date_cast::IsV1<ArgType>(), \
std::conditional_t< \
std::is_same_v<ArgType, DataTypeDate>, \
std::conditional_t<TimeUnit::UNIT == TimeUnit::HOUR || \
TimeUnit::UNIT == TimeUnit::MINUTE || \
TimeUnit::UNIT == TimeUnit::SECOND || \
TimeUnit::UNIT == TimeUnit::SECOND_MICROSECOND, \
DataTypeDateTime, DataTypeDate>, \
DataTypeDateTime>, \
std::conditional_t< \
std::is_same_v<ArgType, DataTypeDateV2>, \
std::conditional_t<TimeUnit::UNIT == TimeUnit::HOUR || \
TimeUnit::UNIT == TimeUnit::MINUTE || \
TimeUnit::UNIT == TimeUnit::SECOND || \
TimeUnit::UNIT == TimeUnit::SECOND_MICROSECOND, \
DataTypeDateTimeV2, DataTypeDateV2>, \
DataTypeDateTimeV2>>; \
static bool has_return_type_in_signature() { \
return true; \
} \
using ReturnNativeType = ReturnType::FieldType; \
using InputNativeType = ArgType::FieldType; \
static constexpr auto name = #NAME; \
static constexpr auto is_nullable = true; \
static inline ReturnNativeType execute(const InputNativeType& t, Int32 delta, \
bool& is_null) { \
return date_time_add<TimeUnit::UNIT, ArgType, ReturnType>(t, delta, is_null); \
} \
\
static DataTypes get_variadic_argument_types() { \
return {std::make_shared<ArgType>(), std::make_shared<DataTypeInt32>()}; \
} \
#define ADD_TIME_FUNCTION_IMPL(CLASS, NAME, UNIT) \
template <typename ArgType> \
struct CLASS { \
/*for V2 type, if unit <= hour, increase to DatetimeV2, for V1 same as V2 version*/ \
using ReturnType = std::conditional_t< \
date_cast::IsV1<ArgType>(), \
std::conditional_t< \
std::is_same_v<ArgType, DataTypeDate>, \
std::conditional_t<TimeUnit::UNIT == TimeUnit::HOUR || \
TimeUnit::UNIT == TimeUnit::MINUTE || \
TimeUnit::UNIT == TimeUnit::SECOND || \
TimeUnit::UNIT == TimeUnit::SECOND_MICROSECOND, \
DataTypeDateTime, DataTypeDate>, \
DataTypeDateTime>, \
std::conditional_t< \
std::is_same_v<ArgType, DataTypeDateV2>, \
std::conditional_t<TimeUnit::UNIT == TimeUnit::HOUR || \
TimeUnit::UNIT == TimeUnit::MINUTE || \
TimeUnit::UNIT == TimeUnit::SECOND || \
TimeUnit::UNIT == TimeUnit::SECOND_MICROSECOND, \
DataTypeDateTimeV2, DataTypeDateV2>, \
DataTypeDateTimeV2>>; \
static bool has_return_type_in_signature() { \
return true; \
} \
using ReturnNativeType = ReturnType::FieldType; \
using InputNativeType = ArgType::FieldType; \
static constexpr auto name = #NAME; \
static constexpr auto is_nullable = true; \
static inline ReturnNativeType execute(const InputNativeType& t, Int32 delta, \
bool& is_null) { \
return date_time_add<TimeUnit::UNIT, ArgType, ReturnType>(t, delta, is_null); \
} \
\
static DataTypes get_variadic_argument_types() { \
return {std::make_shared<ArgType>(), std::make_shared<DataTypeInt32>()}; \
} \
}

ADD_TIME_FUNCTION_IMPL(AddMicrosecondsImpl, microseconds_add, MICROSECOND);
Expand Down

0 comments on commit 8335b3a

Please sign in to comment.