Commit 8fdf3ca
DX-105463: [C++][Gandiva] Add TimestampIR wrapper for next_day (#135)
next_day(timestamp, utf8) was registered in the C++ function registry for
timestamp inputs but was not included in any TimestampIR table, so no _us/_ns
IR wrappers were generated. With the relaxed DataTypeEquals (ignoring TimeUnit),
calls like next_day(timestamp[us], 'MO') pass validation and are routed to
Gandiva, but BuildFunctionCall silently falls through to the precompiled
millis function, which interprets microseconds as milliseconds — producing
dates ~51,000 years in the future (e.g. +53425-02-28 for a 2021 input).
This adds a BuildNextDayWrapper that scales the timestamp input to millis
via FloorDiv and calls the precompiled next_day_from_timestamp(context,
millis, day_str, day_len) function. Pattern follows the cast-from-timestamp
wrapper shape with the additional (context, string, length) args.
No remainder recombination is needed: next_day returns date64 (midnight of
the next weekday), so sub-millisecond input precision is not meaningful in
the result.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 28932a0 commit 8fdf3ca
2 files changed
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
| |||
462 | 463 | | |
463 | 464 | | |
464 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
465 | 500 | | |
466 | 501 | | |
467 | 502 | | |
| |||
775 | 810 | | |
776 | 811 | | |
777 | 812 | | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
778 | 820 | | |
779 | 821 | | |
780 | 822 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
| |||
0 commit comments