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/20 12:51:05 UTC
[GitHub] [arrow] lidavidm commented on a change in pull request #11026: ARROW-13561: [C++] Implement week kernel that accepts WeekOptions
lidavidm commented on a change in pull request #11026:
URL: https://github.com/apache/arrow/pull/11026#discussion_r712127159
##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal.cc
##########
@@ -337,6 +339,41 @@ struct ISOWeek {
Localizer localizer_;
};
Review comment:
Ping on this? Since it seems the two kernels are very similar.
##########
File path: cpp/src/arrow/compute/api_scalar.h
##########
@@ -278,6 +278,23 @@ struct ARROW_EXPORT DayOfWeekOptions : public FunctionOptions {
uint32_t week_start;
};
+struct ARROW_EXPORT WeekOptions : public FunctionOptions {
+ public:
+ explicit WeekOptions(bool week_starts_monday = true, bool count_from_zero = false,
+ bool first_week_in_year = false);
+ constexpr static char const kTypeName[] = "WeekOptions";
+ static WeekOptions Defaults() { return WeekOptions{}; }
+
+ /// What day does the week start with (Monday=true, Sunday=false)
+ bool week_starts_monday;
Review comment:
I think that's reasonable.
##########
File path: cpp/src/arrow/compute/api_scalar.h
##########
@@ -278,6 +278,23 @@ struct ARROW_EXPORT DayOfWeekOptions : public FunctionOptions {
uint32_t week_start;
};
+struct ARROW_EXPORT WeekOptions : public FunctionOptions {
+ public:
+ explicit WeekOptions(bool week_starts_monday = true, bool count_from_zero = false,
+ bool first_week_in_year = false);
+ constexpr static char const kTypeName[] = "WeekOptions";
+ static WeekOptions Defaults() { return WeekOptions{}; }
+
+ /// What day does the week start with (Monday=true, Sunday=false)
+ bool week_starts_monday;
+ /// Dates from current year that fall into last ISO week of the previous year return
+ /// 0 if true and 52 or 53 if false.
+ bool count_from_zero;
Review comment:
If the concern is primarily a confusing API, could we offer default options for 'common' modes like us_week and iso_week? Then the individual options could be left up to people who need/understand what they want.
--
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