Commit b0349ff
feat: support nanosecond date_part (#20674)
Support using 'nanosecond' as a part in the date_part function. If
nanosecond is requested then the date_part will return the seconds, and
smaller units, scaled to nanoseconds. This is consistent with the
behaviour of 'millisecond' and 'microsecond'. In order to accomodate the
required range of results, a request for 'nanosecond' will return a
64-bit integer, rather than a 32-bit integer as is returned for
everything else (except 'epoch').
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->
- Closes #20671
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->
The feature is a) useful & b) documented
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
Yes, some added and modified SLT tests.
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
Only in as much as the implementation now matches the documentation (for
this specific case).
---------
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>1 parent d412ba5 commit b0349ff
File tree
2 files changed
+124
-17
lines changed- datafusion
- functions/src/datetime
- sqllogictest/test_files/datetime
2 files changed
+124
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
170 | 173 | | |
171 | 174 | | |
172 | 175 | | |
| |||
218 | 221 | | |
219 | 222 | | |
220 | 223 | | |
221 | | - | |
| 224 | + | |
222 | 225 | | |
223 | 226 | | |
224 | 227 | | |
| |||
321 | 324 | | |
322 | 325 | | |
323 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
324 | 333 | | |
325 | 334 | | |
326 | 335 | | |
| |||
517 | 526 | | |
518 | 527 | | |
519 | 528 | | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
Lines changed: 77 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
215 | 231 | | |
216 | 232 | | |
217 | 233 | | |
| |||
433 | 449 | | |
434 | 450 | | |
435 | 451 | | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
436 | 458 | | |
437 | 459 | | |
438 | 460 | | |
| |||
448 | 470 | | |
449 | 471 | | |
450 | 472 | | |
451 | | - | |
| 473 | + | |
| 474 | + | |
452 | 475 | | |
| 476 | + | |
| 477 | + | |
453 | 478 | | |
454 | 479 | | |
455 | 480 | | |
| |||
466 | 491 | | |
467 | 492 | | |
468 | 493 | | |
469 | | - | |
| 494 | + | |
470 | 495 | | |
| 496 | + | |
| 497 | + | |
471 | 498 | | |
472 | 499 | | |
473 | 500 | | |
| |||
484 | 511 | | |
485 | 512 | | |
486 | 513 | | |
487 | | - | |
| 514 | + | |
488 | 515 | | |
489 | | - | |
| 516 | + | |
| 517 | + | |
490 | 518 | | |
491 | 519 | | |
492 | 520 | | |
| |||
504 | 532 | | |
505 | 533 | | |
506 | 534 | | |
507 | | - | |
| 535 | + | |
508 | 536 | | |
509 | | - | |
| 537 | + | |
| 538 | + | |
510 | 539 | | |
511 | 540 | | |
512 | 541 | | |
| |||
523 | 552 | | |
524 | 553 | | |
525 | 554 | | |
526 | | - | |
| 555 | + | |
527 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
528 | 579 | | |
529 | 580 | | |
530 | 581 | | |
| |||
579 | 630 | | |
580 | 631 | | |
581 | 632 | | |
582 | | - | |
| 633 | + | |
583 | 634 | | |
| 635 | + | |
| 636 | + | |
584 | 637 | | |
585 | 638 | | |
586 | 639 | | |
| |||
643 | 696 | | |
644 | 697 | | |
645 | 698 | | |
646 | | - | |
| 699 | + | |
647 | 700 | | |
| 701 | + | |
| 702 | + | |
648 | 703 | | |
649 | 704 | | |
650 | 705 | | |
| |||
707 | 762 | | |
708 | 763 | | |
709 | 764 | | |
710 | | - | |
| 765 | + | |
711 | 766 | | |
| 767 | + | |
| 768 | + | |
712 | 769 | | |
713 | 770 | | |
714 | 771 | | |
| |||
797 | 854 | | |
798 | 855 | | |
799 | 856 | | |
800 | | - | |
| 857 | + | |
801 | 858 | | |
| 859 | + | |
| 860 | + | |
802 | 861 | | |
803 | 862 | | |
804 | 863 | | |
| |||
1172 | 1231 | | |
1173 | 1232 | | |
1174 | 1233 | | |
1175 | | - | |
| 1234 | + | |
1176 | 1235 | | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
1177 | 1239 | | |
1178 | 1240 | | |
1179 | 1241 | | |
| |||
1211 | 1273 | | |
1212 | 1274 | | |
1213 | 1275 | | |
1214 | | - | |
| 1276 | + | |
1215 | 1277 | | |
1216 | 1278 | | |
1217 | 1279 | | |
| |||
1495 | 1557 | | |
1496 | 1558 | | |
1497 | 1559 | | |
1498 | | - | |
| 1560 | + | |
1499 | 1561 | | |
1500 | 1562 | | |
1501 | 1563 | | |
| |||
1582 | 1644 | | |
1583 | 1645 | | |
1584 | 1646 | | |
1585 | | - | |
| 1647 | + | |
1586 | 1648 | | |
1587 | 1649 | | |
1588 | 1650 | | |
| |||
0 commit comments