anthonylouisbsb commented on a change in pull request #10137:
URL: https://github.com/apache/arrow/pull/10137#discussion_r756485328



##########
File path: cpp/src/gandiva/gdv_function_stubs.cc
##########
@@ -794,6 +795,53 @@ const char* gdv_fn_initcap_utf8(int64_t context, const 
char* data, int32_t data_
   *out_len = out_idx;
   return out;
 }
+
+int64_t gdv_fn_cast_intervalday_utf8(int64_t context_ptr, int64_t holder_ptr,
+                                     const char* data, int data_len, bool 
in1_validity,
+                                     bool* out_valid) {
+  gandiva::ExecutionContext* context =
+      reinterpret_cast<gandiva::ExecutionContext*>(context_ptr);
+  gandiva::IntervalDaysHolder* holder =
+      reinterpret_cast<gandiva::IntervalDaysHolder*>(holder_ptr);
+  std::string data_as_string(data, data_len);
+  return (*holder)(context, data_as_string, in1_validity, out_valid);
+}
+
+int64_t gdv_fn_cast_intervalday_utf8_int32(int64_t context_ptr, int64_t 
holder_ptr,
+                                           const char* data, int data_len,
+                                           bool in1_validity, int32_t 
/*suppress_errors*/,
+                                           bool /*in3_validity*/, bool* 
out_valid) {
+  gandiva::ExecutionContext* context =
+      reinterpret_cast<gandiva::ExecutionContext*>(context_ptr);
+  gandiva::IntervalDaysHolder* holder =
+      reinterpret_cast<gandiva::IntervalDaysHolder*>(holder_ptr);
+  std::string data_as_string(data, data_len);
+  return (*holder)(context, data_as_string, in1_validity, out_valid);
+}
+
+int32_t gdv_fn_cast_intervalyear_utf8(int64_t context_ptr, int64_t holder_ptr,
+                                      const char* data, int data_len, bool 
in1_validity,
+                                      bool* out_valid) {
+  gandiva::ExecutionContext* context =
+      reinterpret_cast<gandiva::ExecutionContext*>(context_ptr);
+  gandiva::IntervalYearsHolder* holder =
+      reinterpret_cast<gandiva::IntervalYearsHolder*>(holder_ptr);
+  std::string data_as_string(data, data_len);

Review comment:
       It is because there is a moment that I need to pass the value to the 
regex matcher, e.g: 
https://github.com/apache/arrow/blob/637c60eaa40cb6ce3a11813e5c0eee2096721f4c/cpp/src/gandiva/interval_holder.cc#L157
   
   And if I pass the pointer, It throws an error as the buffer contains all 
strings concatenated.




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