apache / apache/arrow-java

[Java] getObject API for temporal types is inconsistent and in some cases incorrect

Đang mở
#324 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Type: bug
Ngôn ngữ chính
Java
Star
94
Fork
152
Merge trung bình
3 ngày 16 giờ
Pull request đã merge (30 ngày)
11

Mô tả

It seems that the work which has been tracked in ARROW-2015 and merged in to change the return types of the various Time and Date vector types when using the getObject API missed some of the vector types which are temporal and so should return a temporal type, and provided an incorrect implementation for others (some of this was pointed out in the initial PR review, but it seems that it slipped through the cracks and was not addressed before merging).

Here is a table of the various temporal vector types, what they currently return from getObject, and what they should return, in my opinion (I have included ones in which the implementation is correct for completeness, and coloured them green).

 

 

|Vector class|Current return type|Proposed return type|Comments|
|
|-|-|-|-|-|
|DateDayVector|Integer|LocalDate|Currently returns the raw value of days since epoch, should return the actual date|
|
|DateMilliVector|LocalDateTime|LocalDate|This type is supposed to encode a date, not a datetime, so even though epoch millis are used, the result should be a LocalDate|
|
|DurationVector|Duration|Duration|Correct.|
|
|IntervalDayVector|Duration|Period|As per , Interval should be a calendar-based datatype, not a time-based one. This is represented in Java by a Period type. However, I note that the Java Period class does not support milliseconds, unlike the Arrow type, which might be why Duration is being returned. Some discussion may be needed on the best way to deal with this.|
|
|IntervalYearVector|Period|Period|Correct.|
|
|TimeMicroVector|Long|LocalTime|Currently returns the raw number of micros, should return the actual time|
|
|TimeMilliVector|LocalDateTime|LocalTime|Currently returns a datetime on 1970-01-01 with the correct time component, should just return the time|
|
|TimeNanoVector|Long|LocalTime|Currently returns the raw number of nanos, should return the actual time|
|
|TimeSecVector|Integer|LocalTime|Currently returns the raw number of seconds, should return the actual time|
|
|TimeStampMicroVector|LocalDateTime|LocalDateTime|Correct.|
|
|TimeStampMilliVector|LocalDateTime|LocalDateTime|Correct.|
|
|TimeStampNanoVector|LocalDateTime|LocalDateTime|Correct.|
|
|TimeStampSecVector|LocalDateTime|LocalDateTime|Correct.|
|
|TimeStampMicroTZVector|Long|ZonedDateTime|Currently returns the underlying micros, and TZ has to be obtained separately. Should return the actual datetime with timezone|
|
|TimeStampMilliTZVector|Long|ZonedDateTime|Currently returns the underlying millis, and TZ has to be obtained separately. Should return the actual datetime with timezone|
|
|TimeStampNanoTZVector|Long|ZonedDateTime|Currently returns the underlying nanos, and TZ has to be obtained separately. Should return the actual datetime with timezone|
|
|TimeStampSecTZVector|Long|ZonedDateTime|Currently returns the underlying seconds, and TZ has to be obtained separately. Should return the actual datetime with timezone|



I am happy to submit a PR to fix this if there is no other reason for this to persist other than these types being rarely used, but note that these would all be breaking API changes.



 |

**Reporter**: [Matt Jadczak](https://issues.apache.org/jira/browse/ARROW-9915)

**Note**: *This issue was originally created as [ARROW-9915](https://issues.apache.org/jira/browse/ARROW-9915). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách xác định các triển khai getObject cho các lớp vector thời gian được liệt kê và xem xét các thay đổi từ ARROW-2015 và pull request 2966. Kiểm tra schema interval của Arrow, đặc biệt là biểu diễn mili-giây của IntervalDayVector, trước khi quyết định các kiểu trả về trong Java. Công việc được xem là hoàn tất khi các vector bị ảnh hưởng trả về nhất quán các kiểu thời gian được đề xuất, với coverage cho từng mapping đã thay đổi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
api
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.