naman1996 commented on a change in pull request #8201:
URL: https://github.com/apache/arrow/pull/8201#discussion_r498037287



##########
File path: cpp/src/gandiva/precompiled/string_ops.cc
##########
@@ -835,6 +835,51 @@ const char* replace_utf8_utf8_utf8(gdv_int64 context, 
const char* text,
                                              out_len);
 }
 
+FORCE_INLINE
+const char* binary_string(gdv_int64 context, const char* text, gdv_int32 
text_len,
+                          gdv_int32* out_len) {
+  gdv_binary ret =
+      reinterpret_cast<gdv_binary>(gdv_fn_context_arena_malloc(context, 
text_len));
+
+  if (ret == nullptr) {
+    gdv_fn_context_set_error_msg(context, "Could not allocate memory for 
output string");
+    *out_len = 0;
+    return "";
+  }
+
+  if (text_len == 0) {
+    *out_len = 0;
+    return "";
+  }
+
+  // converting hex encoded string to normal string
+  int j = 0;
+  for (int i = 0; i < text_len; i++, j++) {
+    if (text[i] == '\\' && i + 3 < text_len &&
+        (text[i + 1] == 'x' || text[i + 1] == 'X')) {
+      char hex_string[3];
+      hex_string[0] = toupper(text[i + 2]);
+      hex_string[1] = toupper(text[i + 3]);
+      hex_string[2] = '\0';
+      uint8_t out;
+      arrow::Status st;

Review comment:
       Not used in other places.
    I have run Dremio unit tests which were using this function on macOS. For 
linux a Gerrit build is currently running which should run unit tests which 
must us this function. So should be good IMO.




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


Reply via email to