projjal commented on a change in pull request #8096:
URL: https://github.com/apache/arrow/pull/8096#discussion_r503656349



##########
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:
       Not really for this message. As you can see from attached commits 
earlier I removed the std::stiring from error path in castInt, but the castInt 
function also started failing after this commit 
https://github.com/apache/arrow/commit/8041ae5fa9a2a0ba6d2ff6bf391d87bf5b6e9b43 
(for the same reason as castFloat); earlier there was no dependency so it 
worked. Since it is not a header only library, we need to either compile all 
the dependent cc files, along with the precompiled functions, to llvm bit code; 
or move this function to a stub function. I think its better to move it to a 
stub function since the dependencies may change.




----------------------------------------------------------------
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]


Reply via email to