pitrou commented on a change in pull request #7312:
URL: https://github.com/apache/arrow/pull/7312#discussion_r433795159
##########
File path: cpp/src/arrow/compute/test_util.h
##########
@@ -82,6 +83,26 @@ struct DatumEqual<Type, enable_if_integer<Type>> {
}
};
+static inline void CheckScalarUnary(std::string func_name,
Review comment:
Shouldn't this be put in a `test_util.cc`?
##########
File path: cpp/src/arrow/compute/kernels/scalar_string.cc
##########
@@ -57,9 +59,57 @@ void AddAsciiLength(FunctionRegistry* registry) {
DCHECK_OK(registry->AddFunction(std::move(func)));
}
+// ----------------------------------------------------------------------
+// strptime string parsing
+
+using StrptimeWrapper = OptionsWrapper<StrptimeOptions>;
+
+struct ParseStrptime {
+ explicit ParseStrptime(const StrptimeOptions& options)
+ : parser(TimestampParser::MakeStrptime(options.format)),
unit(options.unit) {}
+
+ template <typename... Ignored>
+ int64_t Call(KernelContext* ctx, util::string_view val) const {
+ int64_t result = 0;
+ if (!(*parser)(val.data(), val.size(), unit, &result)) {
+ ctx->SetStatus(Status::Invalid("Failed to parse string ", val));
+ }
+ return result;
+ }
+
+ std::shared_ptr<TimestampParser> parser;
+ TimeUnit::type unit;
+};
+
+template <typename Type>
Review comment:
"InputType" perhaps?
----------------------------------------------------------------
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]