You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/07/07 14:56:16 UTC

[GitHub] [arrow] praveenbingo commented on a change in pull request #7653: ARROW-9343: [C++][Gandiva] CastInt/Float from string functions should handle leading/trailing white spaces

praveenbingo commented on a change in pull request #7653:
URL: https://github.com/apache/arrow/pull/7653#discussion_r450928004



##########
File path: cpp/src/gandiva/precompiled/string_ops.cc
##########
@@ -672,4 +674,27 @@ const char* replace_utf8_utf8_utf8(gdv_int64 context, const char* text,
                                              out_len);
 }
 
+#define CAST_NUMERIC_FROM_STRING(OUT_TYPE, ARROW_TYPE, TYPE_NAME)                   \
+  FORCE_INLINE                                                                      \
+  gdv_##OUT_TYPE cast##TYPE_NAME##_utf8(int64_t context, const char* data,          \
+                                        int32_t len) {                              \
+    gdv_##OUT_TYPE val = 0;                                                         \
+    int32_t trimmed_len;                                                            \
+    data = trim_utf8(context, data, len, &trimmed_len);                             \
+    if (!arrow::internal::StringConverter<ARROW_TYPE>::Convert(data, trimmed_len,   \
+                                                               &val)) {             \
+      gdv_fn_context_set_error_msg(context,                                         \
+                                   "Failed parsing the string to required format"); \

Review comment:
       would help to add the string to the error message..




----------------------------------------------------------------
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:
users@infra.apache.org