Skip to content

Commit

Permalink
ESQL Date Nanos Addition and Subtraction (#116839)
Browse files Browse the repository at this point in the history
Resolves #109995

This adds support and tests for addition and subtraction of date nanos with periods and durations. It does not include support for date_diff, which is a separate ticket (#109999). The bulk of the PR is testing, the actual date math is all handled by library functions.

---------

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
not-napoleon and elasticmachine authored Dec 2, 2024
1 parent e10fc3c commit 913e0fb
Show file tree
Hide file tree
Showing 19 changed files with 1,152 additions and 61 deletions.
72 changes: 72 additions & 0 deletions docs/reference/esql/functions/kibana/definition/add.json

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

72 changes: 72 additions & 0 deletions docs/reference/esql/functions/kibana/definition/sub.json

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

4 changes: 4 additions & 0 deletions docs/reference/esql/functions/types/add.asciidoc

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

4 changes: 4 additions & 0 deletions docs/reference/esql/functions/types/sub.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 @@ -415,6 +415,14 @@ public static boolean isDateTimeOrTemporal(DataType t) {
return isDateTime(t) || isTemporalAmount(t);
}

public static boolean isDateTimeOrNanosOrTemporal(DataType t) {
return isDateTime(t) || isTemporalAmount(t) || t == DATE_NANOS;
}

public static boolean isMillisOrNanos(DataType t) {
return t == DATETIME || t == DATE_NANOS;
}

public static boolean areCompatible(DataType left, DataType right) {
if (left == right) {
return true;
Expand Down
Loading

0 comments on commit 913e0fb

Please sign in to comment.