You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Joris Van den Bossche (Jira)" <ji...@apache.org> on 2021/06/15 09:55:00 UTC

[jira] [Created] (ARROW-13081) [C++] Comparison kernels should not allow to compare tz-naive and tz-aware timestamps

Joris Van den Bossche created ARROW-13081:
---------------------------------------------

             Summary: [C++] Comparison kernels should not allow to compare tz-naive and tz-aware timestamps
                 Key: ARROW-13081
                 URL: https://issues.apache.org/jira/browse/ARROW-13081
             Project: Apache Arrow
          Issue Type: Improvement
          Components: C++
            Reporter: Joris Van den Bossche


Currently, when comparing the values of two timestamp arrays, we ignore whether the types have a timezone set or not. For example:

{code}
>>> arr1 = pa.array([1], pa.timestamp("s"))
>>> arr2 = pa.array([1], pa.timestamp("s", tz="UTC"))
>>> pc.equal(arr1, arr2)
<pyarrow.lib.BooleanArray object at 0x7ff9ec897f40>
[
  true
]
>>> pc.greater(arr1, arr2)
<pyarrow.lib.BooleanArray object at 0x7f3fbc09bd60>
[
  false
]

{code}

While absence of a timezone for the tz-naive/local timestamp, we can't compare both values. So I think we should rather raise an error in this case. 
(comparing timestamps with timezones but with a different timezone should be fine, since it's comparing the underlying UTC value which will give the correct result)

---

Note: this will probably depend on the outcome of the discussion on the mailing list about the interpretation of timezone-less timestamps: https://lists.apache.org/thread.html/r8216e5de3efd2935e3907ad9bd20ce07e430952f84de69b36337e5eb%40%3Cdev.arrow.apache.org%3E 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)