augustoasilva commented on a change in pull request #11049:
URL: https://github.com/apache/arrow/pull/11049#discussion_r748173559



##########
File path: cpp/src/gandiva/precompiled/string_ops.cc
##########
@@ -1762,6 +1762,41 @@ const char* replace_utf8_utf8_utf8(gdv_int64 context, 
const char* text,
                                              out_len);
 }
 
+// Returns the quoted string (Includes escape character for any single quotes)
+// E.g. DONT  -> 'DONT'
+//      DON'T -> 'DON\'T'
+FORCE_INLINE
+const char* quote_utf8(gdv_int64 context, const char* in, gdv_int32 in_len,
+                       gdv_int32* out_len) {
+  if (in_len <= 0) {
+    *out_len = 0;
+    return "";
+  }
+  // try to allocate double size output string (worst case)
+  auto out = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, 
in_len * 2));

Review comment:
       Yes, it makes sense, added the +2 for the worst case of the loop




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