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



##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal.cc
##########
@@ -192,6 +195,60 @@ struct TemporalComponentExtract
   }
 };
 
+Status CheckTimezones(const ExecBatch& batch) {
+  const auto& timezone = GetInputTimezone(batch.values[0]);
+  for (int i = 1; i < batch.num_values(); i++) {
+    const auto& other_timezone = GetInputTimezone(batch.values[i]);
+    if (other_timezone != timezone) {
+      return Status::TypeError("Got differing time zone '", other_timezone,
+                               "' for argument ", i + 1, "; expected '", 
timezone, "'");
+    }

Review comment:
       Er, wait. So concretely, if I have these timestamps:
   
   ```
   2019-12-31 18:00:00-0500
   2019-12-31 23:00:00-0500
   ```
   
   In America/New_York, the year difference is 0, but in UTC, the year 
difference is 1 (the latter timestamp is 04:00 on 2020-01-01). This kernel will 
localize the timestamps, so the expected difference is 0. But this kind of 
calculation doesn't make sense if the time zones are different, unless you 
suddenly switch to interpreting zoned timestamps as their underlying UTC value. 
I'm worried this is potentially confusing/a footgun.




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