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



##########
File path: cpp/src/gandiva/precompiled/string_ops.cc
##########
@@ -1361,6 +1361,48 @@ gdv_int32 ascii_utf8(const char* data, gdv_int32 
data_len) {
   return static_cast<gdv_int32>(data[0]);
 }
 
+// Returns the ASCII character having the binary equivalent to A.
+// If A is larger than 256 the result is equivalent to chr(A % 256).
+FORCE_INLINE
+const char* chr_int64(gdv_int64 context, gdv_int64 in, gdv_int32* out_len) {
+  if (in < 0) {

Review comment:
       Even for negative numbers, chr is returning valid values
   
   For e.g. chr(-158) = 'b'

##########
File path: cpp/src/gandiva/precompiled/string_ops.cc
##########
@@ -1361,6 +1361,48 @@ gdv_int32 ascii_utf8(const char* data, gdv_int32 
data_len) {
   return static_cast<gdv_int32>(data[0]);
 }
 
+// Returns the ASCII character having the binary equivalent to A.
+// If A is larger than 256 the result is equivalent to chr(A % 256).
+FORCE_INLINE
+const char* chr_int64(gdv_int64 context, gdv_int64 in, gdv_int32* out_len) {
+  if (in < 0) {
+    *out_len = 0;
+    return "";
+  }
+  in = (in > 256) ? in % 256 : in;

Review comment:
       Please add tests for negative numbers as input




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