Repository navigation
Commit d035fc8
authored
## What's Changed
`DateTimeUtils.getTimestampValue(long)` used `/` and `%` to split epoch
milliseconds into an epoch day and a time within that day. These
operators round toward zero. For negative values that were not exactly
midnight, the existing code fixed the remainder but not the epoch day.
The two parts then referred to different days, so the timestamp came
back one day late.
For example, `-618102000000` ms is 1950-06-01 01:00:00 UTC. The old
division produced epoch day `-7153`, which is 1950-06-02, while the
remainder was 01:00. The method returned 1950-06-02 01:00:00.
This affects DATE values before 1970 when
`ArrowFlightJdbcDateVectorAccessor.getDate(Calendar)` applies a non-zero
calendar offset. The offset moves the value away from midnight and
exposes the division bug.
Closes #1293.
1 parent 91b4a2c commit d035fc8
2 files changed
Lines changed: 16 additions & 8 deletions
File tree
- flight/flight-sql-jdbc-core/src
- main/java/org/apache/arrow/driver/jdbc/utils
- test/java/org/apache/arrow/driver/jdbc/utils
Lines changed: 5 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 58 | + | |
| 59 | + | |
64 | 60 | | |
65 | 61 | | |
66 | | - | |
67 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
68 | 65 | | |
69 | 66 | | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
98 | 109 | | |
0 commit comments