Commit a9570fd
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 a9570fd
2 files changed
Lines changed: 29 additions & 11 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: 13 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
71 | 69 | | |
72 | 70 | | |
73 | 71 | | |
| |||
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
Lines changed: 16 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 | + | |
461 | 477 | | |
462 | 478 | | |
463 | 479 | | |
| |||
0 commit comments