pitrou commented on code in PR #50675:
URL: https://github.com/apache/arrow/pull/50675#discussion_r3664889069


##########
cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc:
##########
@@ -177,6 +178,32 @@ struct TemporalComponentExtractRound
 
   static Status Exec(KernelContext* ctx, const ExecSpan& batch, ExecResult* 
out) {
     const RoundTemporalOptions& options = RoundTemporalState::Get(ctx);
+
+    if constexpr (std::is_same_v<InType, DurationType>) {
+      if (options.calendar_based_origin) {
+        return Status::Invalid(
+            "calendar_based_origin is not supported for duration inputs");
+      }
+
+      if (options.unit == CalendarUnit::WEEK) {
+        RoundTemporalOptions duration_options = options;
+        duration_options.unit = CalendarUnit::DAY;
+        duration_options.multiple *= 7;

Review Comment:
   Hmm, probably? There is a slight risk of overflow and we may want to guard 
for that, but that sounds extremely unlikely as well.



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

Reply via email to