Skip to content

ESQL: replace the is_null function with IS NULL and IS NOT NULL predicates #98412

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

Merged
merged 7 commits into from
Aug 16, 2023

Conversation

astefan
Copy link
Contributor

@astefan astefan commented Aug 11, 2023

No description provided.

@github-actions
Copy link
Contributor

Documentation preview:

@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:QL (Deprecated) Meta label for query languages team label Aug 11, 2023
@elasticsearchmachine
Copy link
Collaborator

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

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!

if (identifier.getText().equalsIgnoreCase("is_null")) {
throw new ParsingException(
source(ctx),
"is_null function is not supported anymore, please use 'is null' or " + "'is not null' constructs instead"
Copy link
Member

Choose a reason for hiding this comment

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

"please use is null/is not null predicates instead "

why the "+"? left over from formatting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, formatting leftover.

"is_null function is not supported anymore, please use 'is null' or " + "'is not null' constructs instead"
);
}
super.exitFunctionExpression(ctx);
Copy link
Member

Choose a reason for hiding this comment

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

No need to call this since it's an empty function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another leftover from the default override ide implementation.

Comment on lines 348 to 353
if (ctx.NOT() != null) {
return new IsNotNull(source, exp);
} else {
return new IsNull(source, exp);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Use the ternary operator to make it a one-liner:
return ctx. NOT() != null ? new IsNotNull(source, exp) : new IsNull(source, exp);

@costin costin added the ES|QL-ui Impacts ES|QL UI label Aug 11, 2023
Copy link
Contributor

@abdonpijpelink abdonpijpelink left a comment

Choose a reason for hiding this comment

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

Looks good, apart from one line that needs to be removed.

| WHERE birth_date IS NULL
| KEEP first_name, last_name
----
--
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--

Copy link
Contributor

Choose a reason for hiding this comment

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

This would break the docs. Interesting that CI didn't catch it.

Copy link
Member

Choose a reason for hiding this comment

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

That's strange! It should.

I'd move this example into a csv-spec and include it like the function docs do. We probably already have an example in there already.

Copy link
Contributor

@bpintea bpintea left a comment

Choose a reason for hiding this comment

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

LGTM

@astefan
Copy link
Contributor Author

astefan commented Aug 16, 2023

@elasticsearchmachine run elasticsearch-ci/bwc

@astefan astefan merged commit 014bd33 into elastic:feature/esql Aug 16, 2023
@astefan astefan deleted the is_null_is_not_null branch August 16, 2023 17:19
csoulios pushed a commit to csoulios/elasticsearch that referenced this pull request Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL ES|QL-ui Impacts ES|QL UI >feature Team:QL (Deprecated) Meta label for query languages team v8.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants