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/31 12:51:58 UTC

[GitHub] [arrow] vvellanki commented on a change in pull request #10350: ARROW-12814: [C++][Gandiva] Implements ABS, FLOOR, PI, SQRT, SIGN, LSHIFT, RSHIFT, CEIL, TRUNC, LN and LOG2 functions

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



##########
File path: cpp/src/gandiva/precompiled/extended_math_ops.cc
##########
@@ -384,19 +493,61 @@ gdv_int64 get_power_of_10(gdv_int32 exp) {
   return power_of_10[exp];
 }
 
-FORCE_INLINE
-gdv_int64 truncate_int64_int32(gdv_int64 in, gdv_int32 out_scale) {
-  bool overflow = false;
-  arrow::BasicDecimal128 decimal = gandiva::decimalops::FromInt64(in, 38, 0, &overflow);
-  arrow::BasicDecimal128 decimal_with_outscale =
-      gandiva::decimalops::Truncate(gandiva::BasicDecimalScalar128(decimal, 38, 0), 38,
-                                    out_scale, out_scale, &overflow);
-  if (out_scale < 0) {
-    out_scale = 0;
-  }
-  return gandiva::decimalops::ToInt64(
-      gandiva::BasicDecimalScalar128(decimal_with_outscale, 38, out_scale), &overflow);
-}
+#define TRUNCATE_INTEGER(TYPE) \
+  FORCE_INLINE                 \
+  gdv_##TYPE truncate_##TYPE(gdv_##TYPE value) { return value; }
+
+#define TRUNCATE_INTEGER_WITH_OUT_SCALE(TYPE)                                         \
+  FORCE_INLINE                                                                        \

Review comment:
       What should happen if there is overflow?
   
   overflow is an in-out parameter.. for some of the later calls overflow could be false - will that cause an issue?




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