[GitHub] [arrow] pitrou commented on a change in pull request #7504: ARROW-9193: [C++] Add method to parse date from null-terminated string

2020-06-22 Thread GitBox


pitrou commented on a change in pull request #7504:
URL: https://github.com/apache/arrow/pull/7504#discussion_r443441540



##
File path: cpp/src/gandiva/to_date_holder.cc
##
@@ -83,7 +83,7 @@ int64_t ToDateHolder::operator()(ExecutionContext* context, 
const std::string& d
   // 1. processes date that do not match the format.
   // 2. does not process time in format +08:00 (or) id.
   int64_t seconds_since_epoch = 0;
-  if (!::arrow::internal::ParseTimestampStrptime(
+  if (!::arrow::internal::ParseTimestampStrptimeFromCString(
   data.c_str(), data.length(), pattern_.c_str(),

Review comment:
   Ah. Well, if you're concerned about performance, you shouldn't create a 
`std::string` there.





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] pitrou commented on a change in pull request #7504: ARROW-9193: [C++] Add method to parse date from null-terminated string

2020-06-22 Thread GitBox


pitrou commented on a change in pull request #7504:
URL: https://github.com/apache/arrow/pull/7504#discussion_r443432735



##
File path: cpp/src/gandiva/to_date_holder.cc
##
@@ -83,7 +83,7 @@ int64_t ToDateHolder::operator()(ExecutionContext* context, 
const std::string& d
   // 1. processes date that do not match the format.
   // 2. does not process time in format +08:00 (or) id.
   int64_t seconds_since_epoch = 0;
-  if (!::arrow::internal::ParseTimestampStrptime(
+  if (!::arrow::internal::ParseTimestampStrptimeFromCString(
   data.c_str(), data.length(), pattern_.c_str(),

Review comment:
   Understood. But where does that data come from? Why do you have a 
`std::string`?





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] pitrou commented on a change in pull request #7504: ARROW-9193: [C++] Add method to parse date from null-terminated string

2020-06-22 Thread GitBox


pitrou commented on a change in pull request #7504:
URL: https://github.com/apache/arrow/pull/7504#discussion_r443428904



##
File path: cpp/src/arrow/util/value_parsing.h
##
@@ -565,6 +565,39 @@ static inline bool ParseTimestampStrptime(const char* buf, 
size_t length,
   return true;
 }
 
+/// \brief Returns time since the UNIX epoch in the requested unit. Takes null 
terminated
+/// buffer as argument
+static inline bool ParseTimestampStrptimeFromCString(const char* buf, size_t 
length,

Review comment:
   Can you please refactor these two functions to avoid duplicated code?





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