You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "David Li (Jira)" <ji...@apache.org> on 2021/10/30 18:13:00 UTC

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

     [ https://issues.apache.org/jira/browse/ARROW-13081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Li resolved ARROW-13081.
------------------------------
    Fix Version/s: 7.0.0
       Resolution: Fixed

Issue resolved by pull request 11541
[https://github.com/apache/arrow/pull/11541]

> [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
>            Assignee: David Li
>            Priority: Major
>              Labels: kernel, pull-request-available, timestamp
>             Fix For: 7.0.0
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> 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)