Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESQL Date Nanos Addition and Subtraction #116839

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
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) {
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 considered adding DATE_NANOS to isDateTime, but that creates a few problems. First off, we use isDateTime in a lot of places, and touching all of them would have made this already quite large PR even larger. Second, there are clearly some places, such as EsqlDataTypeConverter which clearly need to check for exactly DATETIME type, and would have incorrect behavior if we expanded isDateTime to include DATE_NANOS. Given that, it seemed like adding a new function was the safest way to proceed.

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