vvellanki commented on a change in pull request #12480:
URL: https://github.com/apache/arrow/pull/12480#discussion_r828212110



##########
File path: cpp/src/gandiva/precompiled/arithmetic_ops.cc
##########
@@ -363,6 +367,28 @@ NUMERIC_FUNCTION_FOR_REAL(NEGATIVE)
 
 NEGATIVE_INTEGER(int32, 32)
 NEGATIVE_INTEGER(int64, 64)
+NEGATIVE_INTEGER(month_interval, 32)
+
+const int64_t INT_MAX_TO_NEGATIVE_INTERVAL_DAY_TIME = 9223372034707292159;
+
+gdv_int64 negative_daytimeinterval(gdv_int64 context, gdv_day_time_interval 
interval) {
+  if (interval > INT_MAX_TO_NEGATIVE_INTERVAL_DAY_TIME) {
+    gdv_fn_context_set_error_msg(
+        context, "Interval is more than max allowed in negative execution");
+    return 0;
+  }
+
+  int64_t qty_days = interval >> 32;
+  int64_t qty_millis = ((interval & 0x00000000FFFFFFFF) << 32) >> 32;

Review comment:
       Why do we need the << 32 and >> 32? Isn't it enough to mask with 
0xFFFFFFFF?




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to