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 2020/09/28 09:21:04 UTC

[GitHub] [arrow] vvellanki commented on a change in pull request #8231: ARROW-10023: [C++][Gandiva] Implement split_part function in gandiva

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



##########
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:
       Does this work with 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:
users@infra.apache.org