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 2021/04/07 04:13:49 UTC

[GitHub] [arrow] projjal commented on a change in pull request #9750: ARROW-12021: [C++][Gandiva] Implement to_char() function on Gandiva

projjal commented on a change in pull request #9750:
URL: https://github.com/apache/arrow/pull/9750#discussion_r608324514



##########
File path: cpp/src/gandiva/function_registry_string.cc
##########
@@ -114,6 +114,22 @@ std::vector<NativeFunction> GetStringFunctionRegistry() {
                      utf8(), kResultNullIfNull, "substr_utf8_int64_int64",
                      NativeFunction::kNeedsContext),
 
+      NativeFunction("to_char", {}, DataTypeVector{int32(), int64()}, utf8(),

Review comment:
       The signature looks incorrect. Aren't you taking pattern (string) as second argument.
   It should be {int32(), utf8()}

##########
File path: cpp/src/gandiva/gdv_function_stubs.cc
##########
@@ -337,6 +384,42 @@ void ExportedStubFunctions::AddMappings(Engine* engine) const {
 
   engine->AddGlobalMappingForFunc("gdv_fn_castFLOAT8_utf8", types->double_type(), args,
                                   reinterpret_cast<void*>(gdv_fn_castFLOAT8_utf8));
+
+    // gdv_fn_to_char_int32_int64
+    args = {types->i64_type(),       // int64_t execution_context
+            types->i32_type(),       // int32_t value
+            types->i64_type(),       // int64_t len
+            types->i32_ptr_type()};  // int32_t* out_len
+    engine->AddGlobalMappingForFunc(

Review comment:
       This arguments here are also different to your actual function.

##########
File path: cpp/src/gandiva/gdv_function_stubs.cc
##########
@@ -176,6 +180,49 @@ char* gdv_fn_dec_to_string(int64_t context, int64_t x_high, uint64_t x_low,
     return val;                                                                      \
   }
 
+#define GDV_FN_TO_CHAR(IN_TYPE, ARROW_TYPE)                                         \
+  GANDIVA_EXPORT                                                                         \
+  const char* gdv_fn_to_char_##IN_TYPE##_int64(int64_t context, gdv_##IN_TYPE value, \
+                                                   int64_t len, const char* pattern, int32_t * out_len) {     \

Review comment:
       This signature is also different.




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