[GitHub] [arrow] wesm commented on a change in pull request #7120: ARROW-8727: [C++] Don't require stack allocation of any object to use StringConverter, hide behind ParseValue function
wesm commented on a change in pull request #7120: URL: https://github.com/apache/arrow/pull/7120#discussion_r422371276 ## File path: cpp/src/arrow/util/value_parsing.h ## @@ -484,6 +455,14 @@ static inline bool ParseHH_MM_SS(const char* s, std::chrono::duration* } // namespace detail +/// \brief Attempt to convert a string to the primitive type corresponding to +/// an Arrow data type +template +inline bool ParseValue(const char* s, size_t length, typename T::c_type* out, + const ParseContext* ctx = NULLPTR) { + return detail::StringConverter::Convert(s, length, out); +} + Review comment: It doesn't provide much value. I was trying to address @pitrou's comment about parsers that may require some state initialization like a locale and I used Timestamp as an example 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
[GitHub] [arrow] wesm commented on a change in pull request #7120: ARROW-8727: [C++] Don't require stack allocation of any object to use StringConverter, hide behind ParseValue function
wesm commented on a change in pull request #7120: URL: https://github.com/apache/arrow/pull/7120#discussion_r422314767 ## File path: cpp/src/arrow/util/value_parsing.h ## @@ -484,6 +455,14 @@ static inline bool ParseHH_MM_SS(const char* s, std::chrono::duration* } // namespace detail +/// \brief Attempt to convert a string to the primitive type corresponding to +/// an Arrow data type +template +inline bool ParseValue(const char* s, size_t length, typename T::c_type* out, + const ParseContext* ctx = NULLPTR) { + return detail::StringConverter::Convert(s, length, out); +} + Review comment: I still really don't like this because you're pushing requirements from a special case onto the general case 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