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: Fix single value query #102317

Merged
merged 2 commits into from
Nov 16, 2023
Merged

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Nov 16, 2023

This fixes the lucene query that we use to push "is this a single valued field?" into lucene. In particular, it was erroniously turning itself into a noop any time it saw a field that could have either 0 or 1 value per document. It's right and good for the query to noop itself only when a field can only have 1 value per document. This adds logic to check for that.

Closes #102298

This fixes the lucene query that we use to push "is this a single valued
field?" into lucene. In particular, it was erroniously turning itself
into a noop any time it saw a field that could have either 0 or 1 value
per document. It's right and good for the query to noop itself only when
a field can only have 1 value per document. This adds logic to check for
that.

Closes elastic#102298
@elasticsearchmachine
Copy link
Collaborator

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

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

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

@elasticsearchmachine
Copy link
Collaborator

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

@nik9000
Copy link
Member Author

nik9000 commented Nov 16, 2023

This could manifest as some document being erroniously found in a field when that has 0 or 1 value per document. Given that lucene queries don't typically match when there aren't any values you are unlikely to see this unless you negate the query - so something like WHERE NOT(a > 1) where a can have 0 or 1 value.

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

Great find. Thanks @nik9000!

@nik9000 nik9000 merged commit 6eac8df into elastic:main Nov 16, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >bug Team:QL (Deprecated) Meta label for query languages team v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] EsqlSpecIT test {floats.NotGreaterThanMultivalue} failing
3 participants