anthonylouisbsb commented on a change in pull request #9861: URL: https://github.com/apache/arrow/pull/9861#discussion_r623300302
########## File path: cpp/src/gandiva/precompiled/string_ops.cc ########## @@ -1310,6 +1311,196 @@ const char* convert_replace_invalid_fromUTF8_binary(int64_t context, const char* return ret; } +FORCE_INLINE +const char* convert_toDOUBLE_binary(int64_t context, double value, int32_t* out_len) { + *out_len = sizeof(value); + char* ret = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, *out_len)); + + if (ret == nullptr) { + gdv_fn_context_set_error_msg(context, + "Could not allocate memory for the output string"); + + *out_len = 0; + return ""; + } + + memcpy(ret, &value, *out_len); + + return ret; +} + +FORCE_INLINE +const char* convert_toDOUBLE_binary_be(int64_t context, double value, int32_t* out_len) { + // The function behaves like convert_toDOUBLE_binary, but always return the result + // in big endian format + char* ret = const_cast<char*>(convert_toDOUBLE_binary(context, value, out_len)); + +#if ARROW_LITTLE_ENDIAN + std::reverse(ret, ret + *out_len); Review comment: Added a method that do this processing of reverse the buffer -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org