augustoasilva commented on a change in pull request #11166: URL: https://github.com/apache/arrow/pull/11166#discussion_r742404778
########## File path: cpp/src/gandiva/function_registry_string.cc ########## @@ -88,6 +88,10 @@ std::vector<NativeFunction> GetStringFunctionRegistry() { "gdv_fn_initcap_utf8", NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors), + NativeFunction("elt", {}, DataTypeVector{int32(), utf8()}, utf8(), + kResultNullIfNull, "gdv_fn_elt_utf8", + NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors), Review comment: It can return an error if it could not alocate the memory for the output ########## File path: cpp/src/gandiva/function_registry_string.cc ########## @@ -88,6 +88,10 @@ std::vector<NativeFunction> GetStringFunctionRegistry() { "gdv_fn_initcap_utf8", NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors), + NativeFunction("elt", {}, DataTypeVector{int32(), utf8()}, utf8(), + kResultNullIfNull, "gdv_fn_elt_utf8", + NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors), Review comment: It can return an error if it could not alocate the memory for the output and need the context to tag the error with it ########## File path: cpp/src/gandiva/gdv_function_stubs.cc ########## @@ -794,6 +795,54 @@ 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_elt_utf8(int64_t context, int32_t pos, const char* data, Review comment: It was the only way that I've found to simulate a variadic function in Gandiva, but I changed for your approach. ########## File path: cpp/src/gandiva/function_registry_string.cc ########## @@ -88,6 +88,10 @@ std::vector<NativeFunction> GetStringFunctionRegistry() { "gdv_fn_initcap_utf8", NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors), + NativeFunction("elt", {}, DataTypeVector{int32(), utf8()}, utf8(), + kResultNullIfNull, "gdv_fn_elt_utf8", + NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors), Review comment: It can return an error if it could not alocate the memory for the output ########## File path: cpp/src/gandiva/function_registry_string.cc ########## @@ -88,6 +88,10 @@ std::vector<NativeFunction> GetStringFunctionRegistry() { "gdv_fn_initcap_utf8", NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors), + NativeFunction("elt", {}, DataTypeVector{int32(), utf8()}, utf8(), + kResultNullIfNull, "gdv_fn_elt_utf8", + NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors), Review comment: It can return an error if it could not alocate the memory for the output and need the context to tag the error with it ########## File path: cpp/src/gandiva/gdv_function_stubs.cc ########## @@ -794,6 +795,54 @@ 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_elt_utf8(int64_t context, int32_t pos, const char* data, Review comment: It was the only way that I've found to simulate a variadic function in Gandiva, but I changed for your approach. -- 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