|
27 | 27 | #include "gandiva/formatting_utils.h" |
28 | 28 | #include "gandiva/hash_utils.h" |
29 | 29 | #include "gandiva/in_holder.h" |
| 30 | +#include "gandiva/json_holder.h" |
30 | 31 | #include "gandiva/like_holder.h" |
31 | 32 | #include "gandiva/precompiled/types.h" |
32 | 33 | #include "gandiva/random_generator_holder.h" |
|
37 | 38 |
|
38 | 39 | extern "C" { |
39 | 40 |
|
| 41 | +const uint8_t* gdv_fn_get_json_object_utf8_utf8(int64_t ptr, const char* data, int data_len, |
| 42 | + const char* pattern, int pattern_len, int32_t* out_len) { |
| 43 | + gandiva::JsonHolder* holder = reinterpret_cast<gandiva::JsonHolder*>(ptr); |
| 44 | + return (*holder)(std::string(data, data_len), std::string(pattern, pattern_len), out_len); |
| 45 | +} |
| 46 | + |
40 | 47 | bool gdv_fn_like_utf8_utf8(int64_t ptr, const char* data, int data_len, |
41 | 48 | const char* pattern, int pattern_len) { |
42 | 49 | gandiva::LikeHolder* holder = reinterpret_cast<gandiva::LikeHolder*>(ptr); |
@@ -483,6 +490,18 @@ void ExportedStubFunctions::AddMappings(Engine* engine) const { |
483 | 490 | types->i8_ptr_type() /*return_type*/, args, |
484 | 491 | reinterpret_cast<void*>(gdv_fn_dec_to_string)); |
485 | 492 |
|
| 493 | + // gdv_fn_get_json_object_utf8_utf8 |
| 494 | + args = {types->i64_type(), // int64_t ptr |
| 495 | + types->i8_ptr_type(), // const char* data |
| 496 | + types->i32_type(), // int data_len |
| 497 | + types->i8_ptr_type(), // const char* pattern |
| 498 | + types->i32_type(), // int pattern_len |
| 499 | + types->i32_ptr_type()}; // int out_len |
| 500 | + |
| 501 | + engine->AddGlobalMappingForFunc("gdv_fn_get_json_object_utf8_utf8", |
| 502 | + types->i8_ptr_type() /*return_type*/, args, |
| 503 | + reinterpret_cast<void*>(gdv_fn_get_json_object_utf8_utf8)); |
| 504 | + |
486 | 505 | // gdv_fn_like_utf8_utf8 |
487 | 506 | args = {types->i64_type(), // int64_t ptr |
488 | 507 | types->i8_ptr_type(), // const char* data |
|
0 commit comments