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/09/01 09:33:28 UTC

[GitHub] [arrow] lidavidm commented on a change in pull request #11026: ARROW-13561: [C++] Implement week kernel that accepts DayOfWeekOptions

lidavidm commented on a change in pull request #11026:
URL: https://github.com/apache/arrow/pull/11026#discussion_r699313007



##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal.cc
##########
@@ -337,6 +339,41 @@ struct ISOWeek {
   Localizer localizer_;
 };
 
+template <typename Duration, typename Localizer>
+struct Week {
+  explicit Week(const DayOfWeekOptions* options, Localizer&& localizer)
+      : localizer_(std::move(localizer)), count_offset_(options->one_based_numbering) {
+    if (options->week_start == 7) {
+      start_week_ = sun;
+      mid_week_ = wed;
+
+    } else {
+      start_week_ = mon;
+      mid_week_ = thu;
+    }

Review comment:
       Do we intend to only support these two cases? If so we should validate it somewhere and make sure it's described in the docstring.

##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal.cc
##########
@@ -337,6 +339,41 @@ struct ISOWeek {
   Localizer localizer_;
 };

Review comment:
       Given ISOWeek is a special case of Week now, maybe we should just have one kernel (and perhaps some conveniences, e.g. DayOfWeekOptions::IsoWeek())?

##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal.cc
##########
@@ -337,6 +339,41 @@ struct ISOWeek {
   Localizer localizer_;
 };

Review comment:
       Oh, no worries. I can hold off looking at this until you're ready.




-- 
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