Skip to content

Commit

Permalink
Esql - Support date nanos in date extract function (#120727)
Browse files Browse the repository at this point in the history
Resolves #110000

Add support for running the date extract function on nanosecond dates.
  • Loading branch information
not-napoleon committed Jan 27, 2025
1 parent 7245c05 commit 11938cf
Show file tree
Hide file tree
Showing 13 changed files with 825 additions and 58 deletions.
6 changes: 6 additions & 0 deletions docs/changelog/120727.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 120727
summary: Esql - Support date nanos in date extract function
area: ES|QL
type: enhancement
issues:
- 110000
36 changes: 36 additions & 0 deletions docs/reference/esql/functions/kibana/definition/date_extract.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/reference/esql/functions/types/date_extract.asciidoc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,27 @@ millis:date | nanos:date_nanos | num:long
2023-10-23T12:15:03.360Z | 2023-10-23T12:15:03.360103847Z | 1698063303360103847
;

Date nanos date extract
required_capability: date_nanos_date_extract

FROM date_nanos
| EVAL nn = MV_MAX(nanos)
| EVAL year = DATE_EXTRACT("year", nn), ns = DATE_EXTRACT("nano_of_second", nn)
| KEEP nn, year, ns;

nn:date_nanos | year:long | ns:long
2023-10-23T13:55:01.543123456Z | 2023 | 543123456
2023-10-23T13:53:55.832987654Z | 2023 | 832987654
2023-10-23T13:52:55.015787878Z | 2023 | 015787878
2023-10-23T13:51:54.732102837Z | 2023 | 732102837
2023-10-23T13:33:34.937193000Z | 2023 | 937193000
2023-10-23T12:27:28.948000000Z | 2023 | 948000000
2023-10-23T12:15:03.360103847Z | 2023 | 360103847
2023-10-23T12:15:03.360103847Z | 2023 | 360103847
2023-03-23T12:15:03.360103847Z | 2023 | 360103847
2023-03-23T12:15:03.360103847Z | 2023 | 360103847
;

date nanos to long, index version
required_capability: to_date_nanos

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 11938cf

Please sign in to comment.