You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "WinkerDu (via GitHub)" <gi...@apache.org> on 2023/02/21 03:14:15 UTC

[GitHub] [doris] WinkerDu opened a new pull request, #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

WinkerDu opened a new pull request, #16970:
URL: https://github.com/apache/doris/pull/16970

   # Proposed changes
   
   Issue Number: close #16967 
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [x] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] WinkerDu commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "WinkerDu (via GitHub)" <gi...@apache.org>.
WinkerDu commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1438502162

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] WinkerDu commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "WinkerDu (via GitHub)" <gi...@apache.org>.
WinkerDu commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1439692017

   @BiteTheDDDDt Is this pr ok to merge? Or may you invite some other committers review? Thank you :)


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] github-actions[bot] commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1439391090

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] BiteTheDDDDt commented on a diff in pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "BiteTheDDDDt (via GitHub)" <gi...@apache.org>.
BiteTheDDDDt commented on code in PR #16970:
URL: https://github.com/apache/doris/pull/16970#discussion_r1113179687


##########
be/src/vec/runtime/vdatetime_value.cpp:
##########
@@ -2553,17 +2553,25 @@ bool DateV2Value<T>::date_add_interval(const TimeInterval& interval, DateV2Value
 
     int sign = interval.is_neg ? -1 : 1;
 
-    if constexpr ((unit == SECOND) || (unit == MINUTE) || (unit == HOUR) ||
+    if constexpr ((unit == MICROSECOND) || (unit == SECOND) || (unit == MINUTE) || (unit == HOUR) ||
                   (unit == SECOND_MICROSECOND) || (unit == MINUTE_MICROSECOND) ||
                   (unit == MINUTE_SECOND) || (unit == HOUR_MICROSECOND) || (unit == HOUR_SECOND) ||
                   (unit == HOUR_MINUTE) || (unit == DAY_MICROSECOND) || (unit == DAY_SECOND) ||
                   (unit == DAY_MINUTE) || (unit == DAY_HOUR) || (unit == DAY) || (unit == WEEK)) {
         // This may change the day information
+        int64_t microseconds = this->microsecond() + sign * interval.microsecond;
+        int64_t extra_second = microseconds / 1000000L;
+        microseconds %= 1000000L;

Review Comment:
   better define 1000000 to a constexpr value as a common constant.



-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] jackwener commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1438586550

   cc @BiteTheDDDDt 


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] github-actions[bot] commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1438953728

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] BiteTheDDDDt merged pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "BiteTheDDDDt (via GitHub)" <gi...@apache.org>.
BiteTheDDDDt merged PR #16970:
URL: https://github.com/apache/doris/pull/16970


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] github-actions[bot] commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1437873576

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] WinkerDu commented on a diff in pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "WinkerDu (via GitHub)" <gi...@apache.org>.
WinkerDu commented on code in PR #16970:
URL: https://github.com/apache/doris/pull/16970#discussion_r1113454321


##########
be/src/vec/runtime/vdatetime_value.cpp:
##########
@@ -2553,17 +2553,25 @@ bool DateV2Value<T>::date_add_interval(const TimeInterval& interval, DateV2Value
 
     int sign = interval.is_neg ? -1 : 1;
 
-    if constexpr ((unit == SECOND) || (unit == MINUTE) || (unit == HOUR) ||
+    if constexpr ((unit == MICROSECOND) || (unit == SECOND) || (unit == MINUTE) || (unit == HOUR) ||
                   (unit == SECOND_MICROSECOND) || (unit == MINUTE_MICROSECOND) ||
                   (unit == MINUTE_SECOND) || (unit == HOUR_MICROSECOND) || (unit == HOUR_SECOND) ||
                   (unit == HOUR_MINUTE) || (unit == DAY_MICROSECOND) || (unit == DAY_SECOND) ||
                   (unit == DAY_MINUTE) || (unit == DAY_HOUR) || (unit == DAY) || (unit == WEEK)) {
         // This may change the day information
+        int64_t microseconds = this->microsecond() + sign * interval.microsecond;
+        int64_t extra_second = microseconds / 1000000L;
+        microseconds %= 1000000L;

Review Comment:
   OK, will fix it.



-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] github-actions[bot] commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1439391058

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] WinkerDu commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "WinkerDu (via GitHub)" <gi...@apache.org>.
WinkerDu commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1439353851

   @BiteTheDDDDt PTAL, thank you


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] WinkerDu commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "WinkerDu (via GitHub)" <gi...@apache.org>.
WinkerDu commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1437803279

   @Gabriel39 @yangzhg 


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] github-actions[bot] commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1437888931

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] WinkerDu commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "WinkerDu (via GitHub)" <gi...@apache.org>.
WinkerDu commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1438553747

   @jackwener @morrySnow PTAL, thank you.


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] BiteTheDDDDt commented on a diff in pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "BiteTheDDDDt (via GitHub)" <gi...@apache.org>.
BiteTheDDDDt commented on code in PR #16970:
URL: https://github.com/apache/doris/pull/16970#discussion_r1113180943


##########
be/src/vec/runtime/vdatetime_value.cpp:
##########
@@ -2553,17 +2553,25 @@ bool DateV2Value<T>::date_add_interval(const TimeInterval& interval, DateV2Value
 
     int sign = interval.is_neg ? -1 : 1;
 
-    if constexpr ((unit == SECOND) || (unit == MINUTE) || (unit == HOUR) ||
+    if constexpr ((unit == MICROSECOND) || (unit == SECOND) || (unit == MINUTE) || (unit == HOUR) ||
                   (unit == SECOND_MICROSECOND) || (unit == MINUTE_MICROSECOND) ||
                   (unit == MINUTE_SECOND) || (unit == HOUR_MICROSECOND) || (unit == HOUR_SECOND) ||
                   (unit == HOUR_MINUTE) || (unit == DAY_MICROSECOND) || (unit == DAY_SECOND) ||
                   (unit == DAY_MINUTE) || (unit == DAY_HOUR) || (unit == DAY) || (unit == WEEK)) {
         // This may change the day information
+        int64_t microseconds = this->microsecond() + sign * interval.microsecond;
+        int64_t extra_second = microseconds / 1000000L;
+        microseconds %= 1000000L;

Review Comment:
   here can use microseconds-=extra_second*1000000, it is more fast than mod operator



-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] github-actions[bot] commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1437804166

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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: commits-unsubscribe@doris.apache.org

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] [doris] WinkerDu commented on pull request #16970: [Enhancement](datetimev2-enhance) support 'microseconds_add' function for datetimev2

Posted by "WinkerDu (via GitHub)" <gi...@apache.org>.
WinkerDu commented on PR #16970:
URL: https://github.com/apache/doris/pull/16970#issuecomment-1438951541

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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