Commit ea38f7c
committed
Floor-divide DATEDIFF day-numbers for pre-1970 correctness
SQL `/` truncates toward zero, so naive `to_unixtime(x) / 86400` rounds
negative epoch seconds the wrong way and puts e.g. `1969-12-31 12:00`
on the same epoch-day as `1970-01-01 00:00`. Express the floor in pure
integer arithmetic — `(x - ((x MOD d + d) MOD d)) / d` — since isthmus
has no `FLOOR(i64)` signature in the bound catalog. Pin with two
DateTimeScalarFunctionsIT cases that span and sit below the epoch.
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>1 parent 8feacbe commit ea38f7c
2 files changed
Lines changed: 36 additions & 5 deletions
File tree
- sandbox
- plugins/analytics-backend-datafusion/src/main/java/org/opensearch/be/datafusion
- qa/analytics-engine-rest/src/test/java/org/opensearch/analytics/qa
Lines changed: 16 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| |||
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
80 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
81 | 92 | | |
82 | 93 | | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
461 | 481 | | |
462 | 482 | | |
463 | 483 | | |
| |||
0 commit comments