Mryange commented on code in PR #68001:
URL: https://github.com/apache/doris/pull/68001#discussion_r4017555211
##########
be/src/exprs/function/function_date_or_datetime_computation.h:
##########
@@ -1850,48 +1865,26 @@ class FunctionRelativeDay : public IFunction {
return Status::OK();
}
- template <typename DateColumn>
- static Status execute_typed(size_t input_rows_count, const ColumnPtr&
left_col, bool left_const,
- bool right_const, const ColumnString& week_col,
- ColumnDateV2& res_col) {
- const auto& date_col = *assert_cast<const DateColumn*>(left_col.get());
- if (left_const) {
- return execute_vector<true, false>(input_rows_count, date_col,
week_col, res_col);
- } else if (right_const) {
- return execute_vector<false, true>(input_rows_count, date_col,
week_col, res_col);
- }
- return execute_vector<false, false>(input_rows_count, date_col,
week_col, res_col);
- }
-
- template <bool left_const, bool right_const, typename DateColumn>
- static Status execute_vector(size_t input_rows_count, const DateColumn&
left_col,
- const ColumnString& right_col, ColumnDateV2&
res_col) {
- DateV2Value<DateV2ValueType> dtv;
- int week_day;
- if constexpr (left_const) {
- dtv = date_v2_from_date_like(left_col.get_element(0));
- }
- if constexpr (right_const) {
- auto week = right_col.get_data_at(0);
- week_day = day_of_week(week);
+ template <PrimitiveType DateType>
+ static Status execute_vector(size_t input_rows_count, const ColumnPtr&
date_column,
+ const ColumnPtr& week_column, ColumnDateV2&
res_col,
+ NullMap* null_map) {
+ const auto date_view = ColumnView<DateType>::create(date_column);
+ const auto week_view = ColumnView<TYPE_STRING>::create(week_column);
+ for (size_t i = 0; i < input_rows_count; ++i) {
+ if (date_view.is_null_at(i) || week_view.is_null_at(i)) {
+ DORIS_CHECK(null_map != nullptr);
+ (*null_map)[i] = 1;
+ res_col.insert_default();
+ continue;
+ }
+ auto dtv = date_v2_from_date_like(date_view.value_at(i));
+ auto week = week_view.value_at(i);
+ auto week_day = day_of_week(week);
Review Comment:
你说的对,可是过去就是因为他自己手写了null和const的处理,导致他变成错的了。
--
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]