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: allow null in date math #103610

Merged
merged 9 commits into from Jan 3, 2024

Conversation

bpintea
Copy link
Contributor

@bpintea bpintea commented Dec 20, 2023

This fixes null's handling in date math. So far the null (of type NULL) has been rejected by the type resolution. This is now allowed through, leading to a null result, inline with the other types.

Fixes #103085.

This fixes `null`'s handling in date math. So far the `null` (of type
NULL) has been rejected by the type resolution. This is now allowed
through, leading to a `null` result, inline with the other types.
@bpintea bpintea added >bug auto-backport-and-merge Automatically create backport pull requests and merge when ready :Analytics/ES|QL AKA ESQL v8.12.1 v8.13.0 labels Dec 20, 2023
Copy link

Documentation preview:

@elasticsearchmachine
Copy link
Collaborator

Hi @bpintea, I've created a changelog YAML for you.

@bpintea bpintea marked this pull request as ready for review December 20, 2023 15:24
@elasticsearchmachine elasticsearchmachine added the Team:QL (Deprecated) Meta label for query languages team label Dec 20, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-ql (Team:QL)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/elasticsearch-esql (:Query Languages/ES|QL)

@wchaparro wchaparro added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 2, 2024
@elasticsearchmachine elasticsearchmachine removed the Team:QL (Deprecated) Meta label for query languages team label Jan 2, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

Copy link
Member

@costin costin left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -177,6 +177,10 @@ public static boolean isDateTime(DataType type) {
return type == DATETIME;
}

public static boolean isNullOrDateTime(DataType type) {
Copy link
Member

Choose a reason for hiding this comment

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

Since there's already EsqlDataTypes I would remove this method.
Zooming out a bit having both isType and isNullOrType is confusing ? if the null check is so common, why not do it in a generic way instead of having different method variants.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍
There's also isNullOrNumeric(), so i kept the style, but in fact this method's no longer needed, so I removed it.

@bpintea bpintea added the auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Jan 3, 2024
@elasticsearchmachine elasticsearchmachine merged commit 6e9215a into elastic:main Jan 3, 2024
15 checks passed
@bpintea bpintea deleted the esql/fix/103085 branch January 3, 2024 12:48
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.12 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 103610

@bpintea bpintea removed the v8.12.1 label Jan 3, 2024
jbaiera pushed a commit to jbaiera/elasticsearch that referenced this pull request Jan 10, 2024
This fixes `null`'s handling in date math. So far the `null` (of type
`NULL`) has been rejected by the type resolution. This is now allowed
through, leading to a `null` result, inline with the other types.

Fixes elastic#103085.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport-and-merge Automatically create backport pull requests and merge when ready auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ES|QL] Null handling in date math
4 participants