Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions cpp/src/arrow/compute/kernels/scalar_string_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1895,11 +1895,17 @@ TYPED_TEST(TestStringKernels, StrptimeZoneOffset) {
// N.B. BSD strptime only supports (+/-)HHMM and not the wider range
// of values GNU strptime supports.
std::string input1 = R"(["5/1/2020 +0100", null, "12/11/1900 -0130"])";
std::string output1 =
std::string output =
R"(["2020-04-30T23:00:00.000000", null, "1900-12-11T01:30:00.000000"])";
StrptimeOptions options("%m/%d/%Y %z", TimeUnit::MICRO, /*error_is_null=*/true);
this->CheckUnary("strptime", input1, timestamp(TimeUnit::MICRO, "UTC"), output1,
&options);
StrptimeOptions options1("%m/%d/%Y %z", TimeUnit::MICRO, /*error_is_null=*/true);
this->CheckUnary("strptime", input1, timestamp(TimeUnit::MICRO, "UTC"), output,
&options1);

// format without whitespace before %z (GH-35448)
std::string input2 = R"(["2020-05-01T00:00+0100", null, "1900-12-11T00:00-0130"])";
StrptimeOptions options2("%Y-%m-%dT%H:%M%z", TimeUnit::MICRO, /*error_is_null=*/true);
this->CheckUnary("strptime", input2, timestamp(TimeUnit::MICRO, "UTC"), output,
&options2);
}

TYPED_TEST(TestStringKernels, StrptimeDoesNotProvideDefaultOptions) {
Expand Down
1 change: 0 additions & 1 deletion cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,6 @@ const std::string GetZone(const std::string& format) {
zone = "UTC";
break;
}
cur++;
} else {
count = 0;
}
Expand Down