pitrou commented on a change in pull request #11075:
URL: https://github.com/apache/arrow/pull/11075#discussion_r705309008
##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal.cc
##########
@@ -595,20 +622,81 @@ inline std::array<int64_t, 3> GetIsoCalendar(int64_t arg,
Localizer&& localizer)
static_cast<int64_t>(weekday(ymd).iso_encoding())};
}
+template <typename Duration, typename InType>
+struct ISOCalendarWrapper {
+ static Status Get(const Scalar& in, std::array<int64_t, 3>& iso_calendar) {
+ const auto& in_val = internal::UnboxScalar<const InType>::Unbox(in);
+ iso_calendar = GetIsoCalendar<Duration>(in_val, NonZonedLocalizer{});
+ return Status::OK();
+ }
+};
+
template <typename Duration>
+struct ISOCalendarWrapper<Duration, TimestampType> {
+ static Status Get(const Scalar& in, std::array<int64_t, 3>& iso_calendar) {
+ const auto& in_val = internal::UnboxScalar<const TimestampType>::Unbox(in);
+ const auto& timezone = GetInputTimezone(in);
+ if (timezone.empty()) {
+ iso_calendar = GetIsoCalendar<Duration>(in_val, NonZonedLocalizer{});
+ } else {
+ ARROW_ASSIGN_OR_RAISE(auto tz, LocateZone(timezone));
+ iso_calendar = GetIsoCalendar<Duration>(in_val, ZonedLocalizer{tz});
+ }
+ return Status::OK();
+ }
+};
+
+template <typename Duration, typename InType, typename BuilderType>
+struct ISOCalendarVisitValueFunction {
+ static Status Get(std::vector<BuilderType*>& field_builders, const
ArrayData&,
+ StructBuilder* struct_builder,
+ std::function<Status(typename InType::c_type arg)>&
visit_value) {
Review comment:
Same here: `visit_value` should be passed by pointer.
--
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]