pitrou commented on a change in pull request #11358:
URL: https://github.com/apache/arrow/pull/11358#discussion_r741912034
##########
File path: cpp/src/arrow/compute/kernels/scalar_string.cc
##########
@@ -3129,11 +3129,24 @@ struct StrptimeExec {
Result<ValueDescr> ResolveStrptimeOutput(KernelContext* ctx,
const std::vector<ValueDescr>&) {
- if (ctx->state()) {
- return ::arrow::timestamp(StrptimeState::Get(ctx).unit);
+ if (!ctx->state()) {
+ return Status::Invalid("strptime does not provide default
StrptimeOptions");
+ }
+ const StrptimeOptions& options = StrptimeState::Get(ctx);
+ // Check for use of %z or %Z
+ size_t cur = 0;
+ std::string zone = "";
+ while (cur < options.format.size()) {
Review comment:
`cur < options.format.size() - 1` perhaps?
##########
File path: cpp/src/arrow/csv/converter.cc
##########
@@ -344,6 +344,7 @@ struct CustomDecimalPointValueDecoder : public ValueDecoder
{
// Value decoders for timestamps
//
+template <typename ExpectZone>
Review comment:
Similarly, I don't think templating is terribly useful here.
##########
File path: cpp/src/arrow/compute/kernels/scalar_cast_temporal.cc
##########
@@ -421,14 +421,29 @@ struct CastFunctor<TimestampType, Date64Type> {
// ----------------------------------------------------------------------
// String to Timestamp
+template <typename ExpectZone>
Review comment:
I don't think the templating is useful. Parsing the timestamp should be
more costly than a mostly predictable branch.
##########
File path: cpp/src/arrow/compute/kernels/scalar_string.cc
##########
@@ -3129,11 +3129,24 @@ struct StrptimeExec {
Result<ValueDescr> ResolveStrptimeOutput(KernelContext* ctx,
const std::vector<ValueDescr>&) {
- if (ctx->state()) {
- return ::arrow::timestamp(StrptimeState::Get(ctx).unit);
+ if (!ctx->state()) {
+ return Status::Invalid("strptime does not provide default
StrptimeOptions");
+ }
+ const StrptimeOptions& options = StrptimeState::Get(ctx);
+ // Check for use of %z or %Z
+ size_t cur = 0;
+ std::string zone = "";
+ while (cur < options.format.size()) {
Review comment:
`cur < options.format.size() - 1` perhaps?
##########
File path: cpp/src/arrow/csv/converter.cc
##########
@@ -344,6 +344,7 @@ struct CustomDecimalPointValueDecoder : public ValueDecoder
{
// Value decoders for timestamps
//
+template <typename ExpectZone>
Review comment:
Similarly, I don't think templating is terribly useful here.
##########
File path: cpp/src/arrow/compute/kernels/scalar_cast_temporal.cc
##########
@@ -421,14 +421,29 @@ struct CastFunctor<TimestampType, Date64Type> {
// ----------------------------------------------------------------------
// String to Timestamp
+template <typename ExpectZone>
Review comment:
I don't think the templating is useful. Parsing the timestamp should be
more costly than a mostly predictable branch.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]