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

Honor topvalue while determining isMissingvalueCompetitive in case bottom is not set #12520

Merged
merged 4 commits into from
Sep 4, 2023

Conversation

gashutos
Copy link
Contributor

@gashutos gashutos commented Aug 28, 2023

Description

There is a bug introduced with #12334 when field contains missing value and if those missing values are competitive.
isMissingValueCompetitive() implementation gets invoked comparing missingValue with bottom when bottom is not even set when After is set.

We should check with topValue in cases when bottom is not set. This PR adds that check.
Added tests for this scenario as well.

Lucene issue

#12521

@gashutos
Copy link
Contributor Author

This was observed here -> opensearch-project/OpenSearch#9537

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

Thanks for catching this bug, the change looks correct to me.

Copy link

@backslasht backslasht 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, can you add a test for missing bottom minimum value (for desc sort) as well?

@gashutos
Copy link
Contributor Author

gashutos commented Aug 30, 2023

Looks good, can you add a test for missing bottom value as well?

Thanks @backslasht .
Yes the missing value comparison with bottom (as missing value) is in this test already.

{ // test that optimization is not run when missing value setting of SortField is competitive

The test missing was, missing value comparison with top value when bottom is not set and top value is coming as missing value which I added.

@backslasht
Copy link

Looks good, can you add a test for missing bottom minimum value for desc sort as well?

Thanks @backslasht . Yes the missing value comparison with bottom (as missing value) is in this test already.

{ // test that optimization is not run when missing value setting of SortField is competitive

The test missing was, missing value comparison with top value when bottom is not set and top value is coming as missing value which I added.

Sorry, I jumbled the terminologies, I meant a test with missing minimum value for desc sort.

@gashutos
Copy link
Contributor Author

Looks good, can you add a test for missing bottom minimum value for desc sort as well?

Thanks @backslasht . Yes the missing value comparison with bottom (as missing value) is in this test already.

{ // test that optimization is not run when missing value setting of SortField is competitive

The test missing was, missing value comparison with top value when bottom is not set and top value is coming as missing value which I added.

Sorry, I jumbled the terminologies, I meant a test with missing minimum value for desc sort.

Got it, makes sense. Added the test. I kept missing value as Long.MAX_VALUE only for this, it doesnt really matter for our logic for checking its competitiveness.

Signed-off-by: gashutos <[email protected]>
Copy link

@backslasht backslasht left a comment

Choose a reason for hiding this comment

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

Thanks @gashutos for making the changes.

@jpountz
Copy link
Contributor

jpountz commented Aug 30, 2023

I'll merge next week if nobody beats me to it.

lucene/CHANGES.txt Outdated Show resolved Hide resolved
@jpountz jpountz merged commit d631615 into apache:main Sep 4, 2023
@jpountz
Copy link
Contributor

jpountz commented Sep 4, 2023

Thanks @gashutos !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants