You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/07/02 00:23:14 UTC
[GitHub] [arrow] rok commented on a change in pull request #10610: ARROW-13033: [C++] Kernel to localize naive timestamps to a timezone (preserving clock-time)
rok commented on a change in pull request #10610:
URL: https://github.com/apache/arrow/pull/10610#discussion_r662661947
##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal_test.cc
##########
@@ -177,5 +177,17 @@ TEST(ScalarTemporalTest, TestZonedTemporalComponentExtraction) {
ASSERT_RAISES(NotImplemented, Subsecond(timestamps));
}
}
+
+TEST(ScalarTemporalTest, TestLocalizeTimezoneNaiveTimestamp) {
+ std::string timezone = "Asia/Kolkata";
+ const char* times_naive = R"(["1970-01-01T00:00:59", null])";
+ const char* times_utc = R"(["1970-01-01T00:00:59", null])";
+
+ for (auto u : internal::AllTimeUnits()) {
+ auto unit_naive = timestamp(u);
+ auto unit_utc = timestamp(u, timezone);
+ CheckScalarUnary("localize", unit_naive, times_naive, unit_utc, times_utc);
Review comment:
Added a couple.
##########
File path: docs/source/cpp/compute.rst
##########
@@ -906,48 +906,51 @@ Temporal component extraction
These functions extract datetime components (year, month, day, etc) from timestamp type.
Note: this is currently not supported for timestamps with timezone information.
-+--------------------+------------+-------------------+---------------+--------+
-| Function name | Arity | Input types | Output type | Notes |
-+====================+============+===================+===============+========+
-| year | Unary | Temporal | Int64 | |
-+--------------------+------------+-------------------+---------------+--------+
-| month | Unary | Temporal | Int64 | |
-+--------------------+------------+-------------------+---------------+--------+
-| day | Unary | Temporal | Int64 | |
-+--------------------+------------+-------------------+---------------+--------+
-| day_of_week | Unary | Temporal | Int64 | \(1) |
-+--------------------+------------+-------------------+---------------+--------+
-| day_of_year | Unary | Temporal | Int64 | |
-+--------------------+------------+-------------------+---------------+--------+
-| iso_year | Unary | Temporal | Int64 | \(2) |
-+--------------------+------------+-------------------+---------------+--------+
-| iso_week | Unary | Temporal | Int64 | \(2) |
-+--------------------+------------+-------------------+---------------+--------+
-| iso_calendar | Unary | Temporal | Struct | \(3) |
-+--------------------+------------+-------------------+---------------+--------+
-| quarter | Unary | Temporal | Int64 | |
-+--------------------+------------+-------------------+---------------+--------+
-| hour | Unary | Temporal | Int64 | |
-+--------------------+------------+-------------------+---------------+--------+
-| minute | Unary | Temporal | Int64 | |
-+--------------------+------------+-------------------+---------------+--------+
-| second | Unary | Temporal | Int64 | |
-+--------------------+------------+-------------------+---------------+--------+
-| millisecond | Unary | Temporal | Int64 | |
-+--------------------+------------+-------------------+---------------+--------+
-| microsecond | Unary | Temporal | Int64 | |
-+--------------------+------------+-------------------+---------------+--------+
-| nanosecond | Unary | Temporal | Int64 | |
-+--------------------+------------+-------------------+---------------+--------+
-| subsecond | Unary | Temporal | Double | |
-+--------------------+------------+-------------------+---------------+--------+
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| Function name | Arity | Input types | Output type | Notes | Options class |
++====================+============+===================+===============+========+==============================================+
+| year | Unary | Temporal | Int64 | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| month | Unary | Temporal | Int64 | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| day | Unary | Temporal | Int64 | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| day_of_week | Unary | Temporal | Int64 | \(1) | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| day_of_year | Unary | Temporal | Int64 | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| iso_year | Unary | Temporal | Int64 | \(2) | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| iso_week | Unary | Temporal | Int64 | \(2) | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| iso_calendar | Unary | Temporal | Struct | \(3) | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| quarter | Unary | Temporal | Int64 | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| hour | Unary | Temporal | Int64 | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| minute | Unary | Temporal | Int64 | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| second | Unary | Temporal | Int64 | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| millisecond | Unary | Temporal | Int64 | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| microsecond | Unary | Temporal | Int64 | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| nanosecond | Unary | Temporal | Int64 | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| subsecond | Unary | Temporal | Double | | |
++--------------------+------------+-------------------+---------------+--------+----------------------------------------------+
+| localize | Unary | Temporal | Temporal | \(4) | :struct:`TemporalLocalizationOptions` |
Review comment:
Done.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org