You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/07/16 03:25:55 UTC

[GitHub] [arrow] sagnikc-dremio opened a new pull request #7782: ARROW-9501: Add logic in timestampdiff() when end date is last day of…

sagnikc-dremio opened a new pull request #7782:
URL: https://github.com/apache/arrow/pull/7782


   … a month
   
   timestampdiff(month, startDate, endDate) returns wrong result in Gandiva when the endDate < startDate and endDate is the last day of the month. An additional month is said to have passed when the end day is greater than or equal to the start day, but this does not hold true for dates which are last days of the month.
   
   Case in point, if startDate = 2020-01-31, endDate = 2020-02-29, previously timestampdiff() returned 0, but the correct result should be 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] kszucs commented on pull request #7782: ARROW-9501: [C++][Gandiva] Add logic in timestampdiff() when end date is last day of…

Posted by GitBox <gi...@apache.org>.
kszucs commented on pull request #7782:
URL: https://github.com/apache/arrow/pull/7782#issuecomment-663468724


   I mean before squashing the PR to the master branch :)


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



[GitHub] [arrow] vvellanki commented on a change in pull request #7782: ARROW-9501: Add logic in timestampdiff() when end date is last day of…

Posted by GitBox <gi...@apache.org>.
vvellanki commented on a change in pull request #7782:
URL: https://github.com/apache/arrow/pull/7782#discussion_r455560320



##########
File path: cpp/src/gandiva/precompiled/timestamp_arithmetic.cc
##########
@@ -66,7 +96,7 @@ extern "C" {
     if (end_tm.TmMday() < start_tm.TmMday()) {                                        \
       /* case b */                                                                    \
       diff = MONTHS_TO_TIMEUNIT(months_diff - 1, N_MONTHS);                           \
-      return SIGN_ADJUST_DIFF(is_positive, diff);                                     \
+      return SIGN_ADJUST_DIFF(is_positive, diff) + is_last_day_of_month(end_tm);      \

Review comment:
       Change this to:
   is_last_day ? 1 : 0
   
   Lets not add a bool to an int




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



[GitHub] [arrow] kszucs commented on pull request #7782: ARROW-9501: Add logic in timestampdiff() when end date is last day of…

Posted by GitBox <gi...@apache.org>.
kszucs commented on pull request #7782:
URL: https://github.com/apache/arrow/pull/7782#issuecomment-661305131


   @praveenbingo please don't forget to add the relevant components `[C++][Gandiva]` to the pull request's title.


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



[GitHub] [arrow] praveenbingo closed pull request #7782: ARROW-9501: Add logic in timestampdiff() when end date is last day of…

Posted by GitBox <gi...@apache.org>.
praveenbingo closed pull request #7782:
URL: https://github.com/apache/arrow/pull/7782


   


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



[GitHub] [arrow] praveenbingo commented on pull request #7782: ARROW-9501: Add logic in timestampdiff() when end date is last day of…

Posted by GitBox <gi...@apache.org>.
praveenbingo commented on pull request #7782:
URL: https://github.com/apache/arrow/pull/7782#issuecomment-660959362


   thanks @sagnikc-dremio 


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



[GitHub] [arrow] praveenbingo commented on pull request #7782: ARROW-9501: [C++][Gandiva] Add logic in timestampdiff() when end date is last day of…

Posted by GitBox <gi...@apache.org>.
praveenbingo commented on pull request #7782:
URL: https://github.com/apache/arrow/pull/7782#issuecomment-663516636


   Sorry @kszucs missed that. Will monitor in future before merging.


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



[GitHub] [arrow] github-actions[bot] commented on pull request #7782: ARROW-9501: Add logic in timestampdiff() when end date is last day of…

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #7782:
URL: https://github.com/apache/arrow/pull/7782#issuecomment-659136633


   https://issues.apache.org/jira/browse/ARROW-9501


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