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/25 15:52:43 UTC

[GitHub] [incubator-doris] morningman opened a new pull request #4786: [Bug] Fix some date functions to make their result same as MySQL

morningman opened a new pull request #4786:
URL: https://github.com/apache/incubator-doris/pull/4786


   ## Proposed changes
   
   dayofweek, dayofmonth, dayofyear, weekofyear
   
   Also fix ut compilation problem
   
   ## Types of changes
   
   - [x] Bugfix (non-breaking change which fixes an issue)
   
   ## Checklist
   
   - [] I have create an issue on (Fix #4785), and have described the bug/feature there in detail
   


----------------------------------------------------------------
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


[GitHub] [incubator-doris] morningman merged pull request #4786: [Bug] Fix some date functions to make their result same as MySQL

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #4786:
URL: https://github.com/apache/incubator-doris/pull/4786


   


----------------------------------------------------------------
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


[GitHub] [incubator-doris] kangkaisen commented on a change in pull request #4786: [Bug] Fix some date functions to make their result same as MySQL

Posted by GitBox <gi...@apache.org>.
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


[GitHub] [incubator-doris] morningman commented on a change in pull request #4786: [Bug] Fix some date functions to make their result same as MySQL

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #4786:
URL: https://github.com/apache/incubator-doris/pull/4786#discussion_r511761114



##########
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:
       done




----------------------------------------------------------------
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