praveenbingo commented on a change in pull request #8096:
URL: https://github.com/apache/arrow/pull/8096#discussion_r503032643
##########
File path: cpp/src/gandiva/gdv_function_stubs.cc
##########
@@ -150,6 +151,37 @@ char* gdv_fn_dec_to_string(int64_t context, int64_t
x_high, uint64_t x_low,
memcpy(ret, dec_str.data(), *dec_str_len);
return ret;
}
+
+#define CAST_NUMERIC_FROM_STRING(OUT_TYPE, ARROW_TYPE, TYPE_NAME)
\
+ GANDIVA_EXPORT
\
+ OUT_TYPE gdv_fn_cast##TYPE_NAME##_utf8(int64_t context, const char* data,
\
+ int32_t len) {
\
+ OUT_TYPE val = 0;
\
+ /* trim leading and trailing spaces */
\
+ int32_t trimmed_len;
\
+ int32_t start = 0, end = len - 1;
\
+ while (start <= end && data[start] == ' ') {
\
+ ++start;
\
+ }
\
+ while (end >= start && data[end] == ' ') {
\
+ --end;
\
+ }
\
+ trimmed_len = end - start + 1;
\
+ const char* trimmed_data = data + start;
\
+ if (!arrow::internal::ParseValue<ARROW_TYPE>(trimmed_data, trimmed_len,
&val)) { \
+ std::string err =
\
Review comment:
did we make this an external function only for this message? whats the
perf penalty for doing this..
----------------------------------------------------------------
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:
[email protected]