zclllyybb commented on code in PR #57253:
URL: https://github.com/apache/doris/pull/57253#discussion_r2454073413
##########
regression-test/suites/query_p0/sql_functions/datetime_functions/test_date_function.groovy:
##########
Review Comment:
need many other test include testFoldConst, scalar to scalar, ...
##########
be/src/vec/functions/function_date_or_datetime_computation.h:
##########
@@ -580,10 +617,72 @@ class FunctionDateOrDateTimeComputation : public
IFunction {
// vector-const
if (const auto* nest_col1_const =
check_and_get_column<ColumnConst>(*nest_col1)) {
rconst = true;
- const auto col1_inside_const =
- assert_cast<const
IntervalColumnType&>(nest_col1_const->get_data_column());
- Op::vector_constant(sources->get_data(), res_col->get_data(),
- col1_inside_const.get_data()[0], nullmap0,
nullmap1);
+ if constexpr (Transform::IntervalPRealType == TYPE_STRING) {
+ StringRef time_str =
nest_col1_const->get_data_at(0).trim();
Review Comment:
why think col1 is const? for arguments all const, here will get non-const.
##########
be/src/vec/functions/function_date_or_datetime_computation.h:
##########
@@ -124,11 +127,34 @@ ADD_TIME_FUNCTION_IMPL(AddWeeksImpl, weeks_add, WEEK);
ADD_TIME_FUNCTION_IMPL(AddMonthsImpl, months_add, MONTH);
ADD_TIME_FUNCTION_IMPL(AddYearsImpl, years_add, YEAR);
+template <PrimitiveType PType>
+struct AddDaySecondImpl {
+ static constexpr PrimitiveType ArgPType = PType;
+ static constexpr PrimitiveType ReturnType = PType;
+ static constexpr PrimitiveType IntervalPType = PrimitiveType ::TYPE_INT;
+ static constexpr PrimitiveType IntervalPRealType = TYPE_STRING;
Review Comment:
why add this? why cant just use `IntervalPType`?
##########
be/src/vec/functions/function_date_or_datetime_computation.h:
##########
@@ -580,10 +617,72 @@ class FunctionDateOrDateTimeComputation : public
IFunction {
// vector-const
if (const auto* nest_col1_const =
check_and_get_column<ColumnConst>(*nest_col1)) {
rconst = true;
- const auto col1_inside_const =
- assert_cast<const
IntervalColumnType&>(nest_col1_const->get_data_column());
- Op::vector_constant(sources->get_data(), res_col->get_data(),
- col1_inside_const.get_data()[0], nullmap0,
nullmap1);
+ if constexpr (Transform::IntervalPRealType == TYPE_STRING) {
Review Comment:
type is `TYPE_STRING` could represent `day_second` just now. shouldn't put
the logic here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]