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



##########
File path: cpp/src/gandiva/gdv_function_stubs.cc
##########
@@ -794,6 +794,56 @@ const char* gdv_fn_initcap_utf8(int64_t context, const 
char* data, int32_t data_
   *out_len = out_idx;
   return out;
 }
+
+GANDIVA_EXPORT
+const char* gdv_fn_concat_ws_utf8(int64_t context, const char* separator,

Review comment:
       Should I do functions that take upt to 5 inputs, like the elt function?

##########
File path: cpp/src/gandiva/gdv_function_stubs.cc
##########
@@ -794,6 +794,56 @@ const char* gdv_fn_initcap_utf8(int64_t context, const 
char* data, int32_t data_
   *out_len = out_idx;
   return out;
 }
+
+GANDIVA_EXPORT
+const char* gdv_fn_concat_ws_utf8(int64_t context, const char* separator,
+                                  int32_t separator_len, const char* data,
+                                  int32_t data_len, int32_t* out_len) {
+  if (data_len <= 0) {
+    gdv_fn_context_set_error_msg(context, "Data can not be null.");
+    *out_len = 0;
+    return "";
+  }
+
+  std::string concat = "";
+  std::string data_str(data, data_len);

Review comment:
       Fixed.

##########
File path: cpp/src/gandiva/gdv_function_stubs.cc
##########
@@ -794,6 +794,56 @@ const char* gdv_fn_initcap_utf8(int64_t context, const 
char* data, int32_t data_
   *out_len = out_idx;
   return out;
 }
+
+GANDIVA_EXPORT
+const char* gdv_fn_concat_ws_utf8(int64_t context, const char* separator,
+                                  int32_t separator_len, const char* data,
+                                  int32_t data_len, int32_t* out_len) {
+  if (data_len <= 0) {
+    gdv_fn_context_set_error_msg(context, "Data can not be null.");
+    *out_len = 0;
+    return "";
+  }
+
+  std::string concat = "";
+  std::string data_str(data, data_len);
+  std::string sep(separator, separator_len);
+
+  size_t pos_str = 0;
+  std::string token;
+  while ((pos_str = data_str.find(',')) != std::string::npos) {

Review comment:
       It was to simulate a variadic function with an undefined number of 
arguments, but I corrected it to have a fixed number of parameters

##########
File path: cpp/src/gandiva/gdv_function_stubs.cc
##########
@@ -794,6 +794,56 @@ const char* gdv_fn_initcap_utf8(int64_t context, const 
char* data, int32_t data_
   *out_len = out_idx;
   return out;
 }
+
+GANDIVA_EXPORT
+const char* gdv_fn_concat_ws_utf8(int64_t context, const char* separator,

Review comment:
       Should I do functions that take upt to 5 inputs, like the elt function?

##########
File path: cpp/src/gandiva/gdv_function_stubs.cc
##########
@@ -794,6 +794,56 @@ const char* gdv_fn_initcap_utf8(int64_t context, const 
char* data, int32_t data_
   *out_len = out_idx;
   return out;
 }
+
+GANDIVA_EXPORT
+const char* gdv_fn_concat_ws_utf8(int64_t context, const char* separator,
+                                  int32_t separator_len, const char* data,
+                                  int32_t data_len, int32_t* out_len) {
+  if (data_len <= 0) {
+    gdv_fn_context_set_error_msg(context, "Data can not be null.");
+    *out_len = 0;
+    return "";
+  }
+
+  std::string concat = "";
+  std::string data_str(data, data_len);

Review comment:
       Fixed.

##########
File path: cpp/src/gandiva/gdv_function_stubs.cc
##########
@@ -794,6 +794,56 @@ const char* gdv_fn_initcap_utf8(int64_t context, const 
char* data, int32_t data_
   *out_len = out_idx;
   return out;
 }
+
+GANDIVA_EXPORT
+const char* gdv_fn_concat_ws_utf8(int64_t context, const char* separator,
+                                  int32_t separator_len, const char* data,
+                                  int32_t data_len, int32_t* out_len) {
+  if (data_len <= 0) {
+    gdv_fn_context_set_error_msg(context, "Data can not be null.");
+    *out_len = 0;
+    return "";
+  }
+
+  std::string concat = "";
+  std::string data_str(data, data_len);
+  std::string sep(separator, separator_len);
+
+  size_t pos_str = 0;
+  std::string token;
+  while ((pos_str = data_str.find(',')) != std::string::npos) {

Review comment:
       It was to simulate a variadic function with an undefined number of 
arguments, but I corrected it to have a fixed number of parameters




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to