Skip to content

SQL: fix LIKE function equality by considering its pattern as well #40260

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 5 commits into from
Mar 21, 2019

Conversation

astefan
Copy link
Contributor

@astefan astefan commented Mar 20, 2019

This PR adds an equals method to LIKE function so that its pattern is considered as well and not only the field it's applied on.

Fixes #39931.

astefan added 2 commits March 20, 2019 16:18
is considered in the equality check. Whenever the functions are resolved
this check should be used.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

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

LGTM. Good catch

@astefan
Copy link
Contributor Author

astefan commented Mar 20, 2019

@elasticmachine run elasticsearch-ci/2

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


@Override
public boolean equals(Object obj) {
if (false == super.equals(obj)) {
Copy link
Member

Choose a reason for hiding this comment

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

return super.equals(obj) && Objects.equals(((Like) obj).pattern(), pattern());

@astefan
Copy link
Contributor Author

astefan commented Mar 20, 2019

@elasticmachine run elasticsearch-ci/bwc

1 similar comment
@astefan
Copy link
Contributor Author

astefan commented Mar 21, 2019

@elasticmachine run elasticsearch-ci/bwc

@astefan astefan merged commit 4e5d5af into elastic:master Mar 21, 2019
@astefan astefan deleted the 39931_fix branch March 21, 2019 09:42
@astefan astefan added v6.7.1 and removed v6.7.0 labels Mar 21, 2019
astefan added a commit that referenced this pull request Mar 21, 2019
…40260)

* Define a equals method for Like function so that the pattern used
is considered in the equality check. Whenever the functions are resolved
this check should be used.

(cherry picked from commit 4e5d5af)
astefan added a commit that referenced this pull request Mar 21, 2019
…40260)

* Define a equals method for Like function so that the pattern used
is considered in the equality check. Whenever the functions are resolved
this check should be used.

(cherry picked from commit 4e5d5af)
astefan added a commit that referenced this pull request Mar 21, 2019
…40260)

* Define a equals method for Like function so that the pattern used
is considered in the equality check. Whenever the functions are resolved
this check should be used.

(cherry picked from commit 4e5d5af)
@astefan astefan removed the v6.6.3 label Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL: wrong query when LIKE and NOT LIKE are used together with aggregate functions
6 participants