| 895 | namespace gandiva { |
| 896 | |
| 897 | arrow::Status ExportedStubFunctions::AddMappings(Engine* engine) const { |
| 898 | std::vector<llvm::Type*> args; |
| 899 | auto types = engine->types(); |
| 900 | |
| 901 | // gdv_fn_random |
| 902 | args = {types->i64_type()}; |
| 903 | engine->AddGlobalMappingForFunc("gdv_fn_random", types->double_type(), args, |
| 904 | reinterpret_cast<void*>(gdv_fn_random)); |
| 905 | |
| 906 | args = {types->i64_type(), types->i32_type(), types->i1_type()}; |
| 907 | engine->AddGlobalMappingForFunc("gdv_fn_random_with_seed", types->double_type(), args, |
| 908 | reinterpret_cast<void*>(gdv_fn_random_with_seed)); |
| 909 | |
| 910 | // gdv_fn_rand_integer |
| 911 | args = {types->i64_type()}; |
| 912 | engine->AddGlobalMappingForFunc("gdv_fn_rand_integer", types->i32_type(), args, |
| 913 | reinterpret_cast<void*>(gdv_fn_rand_integer)); |
| 914 | |
| 915 | args = {types->i64_type(), types->i32_type(), types->i1_type()}; |
| 916 | engine->AddGlobalMappingForFunc( |
| 917 | "gdv_fn_rand_integer_with_range", types->i32_type(), args, |
| 918 | reinterpret_cast<void*>(gdv_fn_rand_integer_with_range)); |
| 919 | |
| 920 | args = {types->i64_type(), types->i32_type(), types->i1_type(), types->i32_type(), |
| 921 | types->i1_type()}; |
| 922 | engine->AddGlobalMappingForFunc( |
| 923 | "gdv_fn_rand_integer_with_min_max", types->i32_type(), args, |
| 924 | reinterpret_cast<void*>(gdv_fn_rand_integer_with_min_max)); |
| 925 | |
| 926 | // gdv_fn_dec_from_string |
| 927 | args = { |
| 928 | types->i64_type(), // context |
| 929 | types->i8_ptr_type(), // const char* in |
| 930 | types->i32_type(), // int32_t in_length |
| 931 | types->i32_ptr_type(), // int32_t* precision_from_str |
| 932 | types->i32_ptr_type(), // int32_t* scale_from_str |
| 933 | types->i64_ptr_type(), // int64_t* dec_high_from_str |
| 934 | types->i64_ptr_type(), // int64_t* dec_low_from_str |
| 935 | }; |
| 936 | |
| 937 | engine->AddGlobalMappingForFunc("gdv_fn_dec_from_string", |
| 938 | types->i32_type() /*return_type*/, args, |
| 939 | reinterpret_cast<void*>(gdv_fn_dec_from_string)); |
| 940 | |
| 941 | // gdv_fn_dec_to_string |
| 942 | args = { |
| 943 | types->i64_type(), // context |
| 944 | types->i64_type(), // int64_t x_high |
| 945 | types->i64_type(), // int64_t x_low |
| 946 | types->i32_type(), // int32_t x_scale |
| 947 | types->i64_ptr_type(), // int64_t* dec_str_len |
| 948 | }; |
| 949 | |
| 950 | engine->AddGlobalMappingForFunc("gdv_fn_dec_to_string", |
| 951 | types->i8_ptr_type() /*return_type*/, args, |
| 952 | reinterpret_cast<void*>(gdv_fn_dec_to_string)); |
| 953 | |
| 954 | // gdv_fn_in_expr_lookup_int32 |
nothing calls this directly
no test coverage detected