| 219 | } |
| 220 | |
| 221 | char* gdv_fn_dec_to_string(int64_t context, int64_t x_high, uint64_t x_low, |
| 222 | int32_t x_scale, int32_t* dec_str_len) { |
| 223 | arrow::Decimal128 dec(arrow::BasicDecimal128(x_high, x_low)); |
| 224 | std::string dec_str = dec.ToString(x_scale); |
| 225 | *dec_str_len = static_cast<int32_t>(dec_str.length()); |
| 226 | char* ret = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, *dec_str_len)); |
| 227 | if (ret == nullptr) { |
| 228 | std::string err_msg = "Could not allocate memory for string: " + dec_str; |
| 229 | gdv_fn_context_set_error_msg(context, err_msg.data()); |
| 230 | return nullptr; |
| 231 | } |
| 232 | memcpy(ret, dec_str.data(), *dec_str_len); |
| 233 | return ret; |
| 234 | } |
| 235 | |
| 236 | GANDIVA_EXPORT |
| 237 | const char* gdv_fn_base64_encode_binary(int64_t context, const char* in, int32_t in_len, |
no test coverage detected