in cpp/src/gandiva/gdv_string_function_stubs.cc [762:990]
arrow::Status ExportedStringFunctions::AddMappings(Engine* engine) const {
std::vector<llvm::Type*> args;
auto types = engine->types();
// gdv_fn_like_utf8_utf8
args = {types->i64_type(), // int64_t ptr
types->i8_ptr_type(), // const char* data
types->i32_type(), // int data_len
types->i8_ptr_type(), // const char* pattern
types->i32_type()}; // int pattern_len
engine->AddGlobalMappingForFunc("gdv_fn_like_utf8_utf8",
types->i1_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_like_utf8_utf8));
// gdv_fn_like_utf8_utf8_utf8
args = {types->i64_type(), // int64_t ptr
types->i8_ptr_type(), // const char* data
types->i32_type(), // int data_len
types->i8_ptr_type(), // const char* pattern
types->i32_type(), // int pattern_len
types->i8_ptr_type(), // const char* escape_char
types->i32_type()}; // int escape_char_len
engine->AddGlobalMappingForFunc("gdv_fn_like_utf8_utf8_utf8",
types->i1_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_like_utf8_utf8_utf8));
// gdv_fn_ilike_utf8_utf8
args = {types->i64_type(), // int64_t ptr
types->i8_ptr_type(), // const char* data
types->i32_type(), // int data_len
types->i8_ptr_type(), // const char* pattern
types->i32_type()}; // int pattern_len
engine->AddGlobalMappingForFunc("gdv_fn_ilike_utf8_utf8",
types->i1_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_ilike_utf8_utf8));
// gdv_fn_regexp_replace_utf8_utf8
args = {types->i64_type(), // int64_t ptr
types->i64_type(), // int64_t holder_ptr
types->i8_ptr_type(), // const char* data
types->i32_type(), // int data_len
types->i8_ptr_type(), // const char* pattern
types->i32_type(), // int pattern_len
types->i8_ptr_type(), // const char* replace_string
types->i32_type(), // int32_t replace_string_len
types->i32_ptr_type()}; // int32_t* out_length
engine->AddGlobalMappingForFunc(
"gdv_fn_regexp_replace_utf8_utf8", types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_regexp_replace_utf8_utf8));
// gdv_fn_regexp_extract_utf8_utf8_int32
args = {types->i64_type(), // int64_t ptr
types->i64_type(), // int64_t holder_ptr
types->i8_ptr_type(), // const char* data
types->i32_type(), // int data_len
types->i8_ptr_type(), // const char* pattern
types->i32_type(), // int pattern_len
types->i32_type(), // int32_t extract_index
types->i32_ptr_type()}; // int32_t* out_length
engine->AddGlobalMappingForFunc(
"gdv_fn_regexp_extract_utf8_utf8_int32", types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_regexp_extract_utf8_utf8_int32));
// gdv_fn_castVARCHAR_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(
"gdv_fn_castVARCHAR_int32_int64", types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_castVARCHAR_int32_int64));
// gdv_fn_castVARCHAR_int64_int64
args = {types->i64_type(), // int64_t execution_context
types->i64_type(), // int64_t value
types->i64_type(), // int64_t len
types->i32_ptr_type()}; // int32_t* out_len
engine->AddGlobalMappingForFunc(
"gdv_fn_castVARCHAR_int64_int64", types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_castVARCHAR_int64_int64));
// gdv_fn_castVARCHAR_milliseconds
args = {types->i64_type(), // int64_t execution_context
types->i64_type(), // gdv_date64 value
types->i64_type(), // int64_t len
types->i32_ptr_type()}; // int32_t* out_len
engine->AddGlobalMappingForFunc(
"gdv_fn_castVARCHAR_date64_int64", types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_castVARCHAR_date64_int64));
// gdv_fn_castVARCHAR_float32_int64
args = {types->i64_type(), // int64_t execution_context
types->float_type(), // float value
types->i64_type(), // int64_t len
types->i32_ptr_type()}; // int32_t* out_len
engine->AddGlobalMappingForFunc(
"gdv_fn_castVARCHAR_float32_int64", types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_castVARCHAR_float32_int64));
// gdv_fn_castVARCHAR_float64_int64
args = {types->i64_type(), // int64_t execution_context
types->double_type(), // double value
types->i64_type(), // int64_t len
types->i32_ptr_type()}; // int32_t* out_len
engine->AddGlobalMappingForFunc(
"gdv_fn_castVARCHAR_float64_int64", types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_castVARCHAR_float64_int64));
// gdv_fn_castVARBINARY_int32
args = {
types->i64_type(), // context
types->i32_type(), // int32_t value
types->i64_type(), // int64_t out value length
types->i32_ptr_type() // int32_t out_length
};
engine->AddGlobalMappingForFunc(
"gdv_fn_castVARBINARY_int32_int64", types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_castVARBINARY_int32_int64));
// gdv_fn_castVARBINARY_int64
args = {
types->i64_type(), // context
types->i64_type(), // int64_t value
types->i64_type(), // int64_t out value length
types->i32_ptr_type() // int32_t out_length
};
engine->AddGlobalMappingForFunc(
"gdv_fn_castVARBINARY_int64_int64", types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_castVARBINARY_int64_int64));
// gdv_fn_castVARBINARY_float32
args = {
types->i64_type(), // context
types->float_type(), // float value
types->i64_type(), // int64_t out value length
types->i64_ptr_type() // int32_t out_length
};
engine->AddGlobalMappingForFunc(
"gdv_fn_castVARBINARY_float32_int64", types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_castVARBINARY_float32_int64));
// gdv_fn_castVARBINARY_float64
args = {
types->i64_type(), // context
types->i64_type(), // double value
types->i64_type(), // int64_t out value length
types->i32_ptr_type() // int32_t out_length
};
engine->AddGlobalMappingForFunc(
"gdv_fn_castVARBINARY_float64_int64", types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_castVARBINARY_float64_int64));
// gdv_fn_lower_utf8
args = {
types->i64_type(), // context
types->i8_ptr_type(), // data
types->i32_type(), // data_len
types->i32_ptr_type(), // out_len
};
engine->AddGlobalMappingForFunc("gdv_fn_lower_utf8",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_lower_utf8));
// gdv_fn_upper_utf8
args = {
types->i64_type(), // context
types->i8_ptr_type(), // data
types->i32_type(), // data_len
types->i32_ptr_type(), // out_len
};
engine->AddGlobalMappingForFunc("gdv_fn_upper_utf8",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_upper_utf8));
// gdv_fn_substring_index
args = {
types->i64_type(), // context
types->i8_ptr_type(), // txt
types->i32_type(), // txt_len
types->i8_ptr_type(), // pat
types->i32_type(), // pat_len
types->i32_type(), // cnt
types->i32_ptr_type(), // out_len
};
engine->AddGlobalMappingForFunc("gdv_fn_substring_index",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_substring_index));
// gdv_fn_initcap_utf8
args = {
types->i64_type(), // context
types->i8_ptr_type(), // const char*
types->i32_type(), // value_length
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("gdv_fn_initcap_utf8",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(gdv_fn_initcap_utf8));
// translate_utf8_utf8_utf8
args = {
types->i64_type(), // context
types->i8_ptr_type(), // const char*
types->i32_type(), // value_length
types->i8_ptr_type(), // const char*
types->i32_type(), // value_length
types->i8_ptr_type(), // const char*
types->i32_type(), // value_length
types->i32_ptr_type() // out_length
};
engine->AddGlobalMappingForFunc("translate_utf8_utf8_utf8",
types->i8_ptr_type() /*return_type*/, args,
reinterpret_cast<void*>(translate_utf8_utf8_utf8));
return arrow::Status::OK();
}