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



##########
File path: cpp/src/gandiva/precompiled/string_ops.cc
##########
@@ -835,6 +845,59 @@ const char* replace_utf8_utf8_utf8(gdv_int64 context, 
const char* text,
                                              out_len);
 }
 
+FORCE_INLINE
+const char* split_part(gdv_int64 context, const char* text, gdv_int32 text_len,
+                       const char* delimiter, gdv_int32 delim_len, gdv_int32 
index,
+                       gdv_int32* out_len) {
+  char* ret;
+  if (index < 1) {
+    gdv_fn_context_set_error_msg(context, "Index should be >= 1");
+    return "";
+  }
+
+  if (delim_len == 0 || text_len == 0) {
+    // output will just be text if no delimiter is provided
+    return text;
+  }
+
+  // converting both c style arrays to string for easy processing
+  std::string input = std::string(text);

Review comment:
       Have removed usages of std::string and have also added some unit tests 
for utf-8 strings and utf-8 delimiters.




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