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/09/02 12:56:33 UTC
[GitHub] [arrow] projjal opened a new pull request #8096: ARROW-9898: Fix error handling in castINT function
projjal opened a new pull request #8096:
URL: https://github.com/apache/arrow/pull/8096
In some environments the castINT functions leads to segfault in error path. This is likely a linking issue with c++ std library due to std::string usage.
Replacing std::string usage with cstring library functions.
----------------------------------------------------------------
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
[GitHub] [arrow] projjal commented on pull request #8096: ARROW-9898: [C++][Gandiva] Fix linking issue with castINT/FLOAT functions
Posted by GitBox <gi...@apache.org>.
projjal commented on pull request #8096:
URL: https://github.com/apache/arrow/pull/8096#issuecomment-705977368
> Would it be possible to add an example to cause SIGSEGV?
I have added java tests that causes crashes
----------------------------------------------------------------
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
[GitHub] [arrow] kiszk commented on pull request #8096: ARROW-9898: [C++][Gandiva] Fix error handling in castINT function
Posted by GitBox <gi...@apache.org>.
kiszk commented on pull request #8096:
URL: https://github.com/apache/arrow/pull/8096#issuecomment-686487476
Would it be possible to add an example to cause SIGSEGV?
----------------------------------------------------------------
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
[GitHub] [arrow] praveenbingo closed pull request #8096: ARROW-9898: [C++][Gandiva] Fix linking issue with castINT/FLOAT functions
Posted by GitBox <gi...@apache.org>.
praveenbingo closed pull request #8096:
URL: https://github.com/apache/arrow/pull/8096
----------------------------------------------------------------
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
[GitHub] [arrow] projjal commented on pull request #8096: ARROW-9898: [C++][Gandiva] Fix linking issue with castINT/FLOAT functions
Posted by GitBox <gi...@apache.org>.
projjal commented on pull request #8096:
URL: https://github.com/apache/arrow/pull/8096#issuecomment-705977368
> Would it be possible to add an example to cause SIGSEGV?
I have added java tests that causes crashes
----------------------------------------------------------------
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
[GitHub] [arrow] projjal commented on a change in pull request #8096: ARROW-9898: [C++][Gandiva] Fix linking issue with castINT/FLOAT functions
Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org
[GitHub] [arrow] praveenbingo commented on pull request #8096: ARROW-9898: [C++][Gandiva] Fix linking issue with castINT/FLOAT functions
Posted by GitBox <gi...@apache.org>.
praveenbingo commented on pull request #8096:
URL: https://github.com/apache/arrow/pull/8096#issuecomment-706851916
also looks like this needs a rebase
----------------------------------------------------------------
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
[GitHub] [arrow] github-actions[bot] commented on pull request #8096: ARROW-9898: [C++][Gandiva] Fix error handling in castINT function
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #8096:
URL: https://github.com/apache/arrow/pull/8096#issuecomment-685723647
https://issues.apache.org/jira/browse/ARROW-9898
----------------------------------------------------------------
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
[GitHub] [arrow] praveenbingo commented on a change in pull request #8096: ARROW-9898: [C++][Gandiva] Fix linking issue with castINT/FLOAT functions
Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org