Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog/120645.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 120645
summary: Esql Support date nanos on date diff function
area: ES|QL
type: enhancement
issues:
- 109999
144 changes: 144 additions & 0 deletions docs/reference/esql/functions/kibana/definition/date_diff.json

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

6 changes: 6 additions & 0 deletions docs/reference/esql/functions/types/date_diff.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 @@ -1249,3 +1249,26 @@ sv_nanos:date_nanos | a:keyword | b:keyword | c:keywo
2023-03-23T12:15:03.360103847Z | 2023-03-23T12:15:03.360Z | 2023-03-23 | 2023-03-23T12:15:03.360103847Z
2023-03-23T12:15:03.360103847Z | 2023-03-23T12:15:03.360Z | 2023-03-23 | 2023-03-23T12:15:03.360103847Z
;

Date Nanos Date Diff
required_capability: date_nanos_date_diff
required_capability: to_date_nanos

FROM date_nanos
| EVAL n = MV_MAX(nanos)
| EVAL diff_sec = DATE_DIFF("seconds", TO_DATE_NANOS("2023-10-23T12:15:03.360103847Z"), n)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add two extra cases for the combinations of millis and nanos? Maybe in this same test, as extra columns

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added one such.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, maybe another test with the first param coming from an index, as we don't test it here. From an index, or from a CASE(). Whatever, as long as it's not a constant

| KEEP diff_sec, n;
ignoreOrder:true

diff_sec:integer | n:date_nanos
5998 | 2023-10-23T13:55:01.543123456Z
5932 | 2023-10-23T13:53:55.832987654Z
5871 | 2023-10-23T13:52:55.015787878Z
5811 | 2023-10-23T13:51:54.732102837Z
4711 | 2023-10-23T13:33:34.937193000Z
745 | 2023-10-23T12:27:28.948000000Z
0 | 2023-10-23T12:15:03.360103847Z
0 | 2023-10-23T12:15:03.360103847Z
-18489600 | 2023-03-23T12:15:03.360103847Z
-18489600 | 2023-03-23T12:15:03.360103847Z
;

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

Loading