You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/10/26 02:00:07 UTC
[GitHub] [incubator-doris] kangkaisen commented on a change in pull request #4786: [Bug] Fix some date functions to make their result same as MySQL
kangkaisen commented on a change in pull request #4786:
URL: https://github.com/apache/incubator-doris/pull/4786#discussion_r511685489
##########
File path: be/src/exprs/timestamp_functions.cpp
##########
@@ -126,7 +126,10 @@ IntVal TimestampFunctions::day_of_week(
return IntVal::null();
}
const DateTimeValue& ts_value = DateTimeValue::from_datetime_val(ts_val);
- return IntVal((ts_value.weekday() + 1 ) % 7 + 1);
+ if (ts_value.is_valid_date()) {
+ return IntVal((ts_value.weekday() + 1 ) % 7 + 1);
+ }
+ return IntVal::null();
Review comment:
Should add UT to cover this case.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org