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 2022/01/20 15:42:07 UTC

[GitHub] [arrow] anthonylouisbsb commented on a change in pull request #10425: ARROW-12910: [Gandiva][C++]Add support for ADD and SUBTRACT functions receiving time intervals

anthonylouisbsb commented on a change in pull request #10425:
URL: https://github.com/apache/arrow/pull/10425#discussion_r788890693



##########
File path: cpp/src/gandiva/precompiled/time_test.cc
##########
@@ -397,6 +424,36 @@ TEST(TestTime, TimeStampAdd) {
 
   EXPECT_EQ(date_diff_timestamp_int64(StringToTimestamp("2000-02-29 00:00:00"), 365),
             StringToTimestamp("1999-03-01 00:00:00"));
+
+  EXPECT_EQ(
+      subtract_timestamp_month_interval(StringToTimestamp("2000-02-27 00:00:00"), 4),

Review comment:
       Ditto

##########
File path: cpp/src/gandiva/precompiled/time_test.cc
##########
@@ -382,6 +386,29 @@ TEST(TestTime, TimeStampAdd) {
   EXPECT_EQ(add_date64_int64(StringToTimestamp("2000-02-27 00:00:00"), 4),
             StringToTimestamp("2000-03-02 00:00:00"));
 
+  EXPECT_EQ(add_timestamp_month_interval(StringToTimestamp("2000-02-27 00:00:00"), 4),

Review comment:
       Another test case, for leap years, if the date is `2016-01-29` and you add one month, check if the result will be `2016-01-28`

##########
File path: cpp/src/gandiva/precompiled/time_test.cc
##########
@@ -382,6 +386,29 @@ TEST(TestTime, TimeStampAdd) {
   EXPECT_EQ(add_date64_int64(StringToTimestamp("2000-02-27 00:00:00"), 4),
             StringToTimestamp("2000-03-02 00:00:00"));
 
+  EXPECT_EQ(add_timestamp_month_interval(StringToTimestamp("2000-02-27 00:00:00"), 4),

Review comment:
       What happens if the user passes a negative number to this function? It works or raise an error?

##########
File path: cpp/src/gandiva/precompiled/time_test.cc
##########
@@ -382,6 +386,29 @@ TEST(TestTime, TimeStampAdd) {
   EXPECT_EQ(add_date64_int64(StringToTimestamp("2000-02-27 00:00:00"), 4),
             StringToTimestamp("2000-03-02 00:00:00"));
 
+  EXPECT_EQ(add_timestamp_month_interval(StringToTimestamp("2000-02-27 00:00:00"), 4),

Review comment:
       Another test case is using a huge number to add months, like the limit of the integer




-- 
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: github-unsubscribe@arrow.apache.org

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