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

Fix points writing with no values #13378

Merged
merged 3 commits into from
May 16, 2024

Conversation

ChrisHegarty
Copy link
Contributor

@ChrisHegarty ChrisHegarty commented May 16, 2024

This commit updates the writer to handle the case where there are no values.

Previously (before #13369), there was a check that there were some points values before trying to write, this is no longer the case. The code in writeFieldNDims has an assumption that the values is not empty - an empty values will result in calculating a negative number of splits, and a negate array size to hold the splits.

The fix is trivial, return null when values is empty - null is an allowable return value from this method. Note: writeField1Dim is able to handle an empty values.

After this change both the newly failing test, TestIndexWriterExceptions2.testBasics, and the test added for #13369, testExceptionJustBeforeFlushWithPointValues, pass successfully several thousands of times. No new test is added, as testBasics already covers this.

closes #13377

Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

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

@ChrisHegarty Thanks for the detailed explanation and fix, makes sense

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, the fix looks good to me. This makes me want to also improve the test from #13369 to add an assertNull(onlyReader.getPointValues("field"));, could you do it as part of this PR? The connection with your PR is that we're not writing empty fields, so getting a PointValues instance should return null, not an empty instance.

@ChrisHegarty
Copy link
Contributor Author

Thanks, the fix looks good to me. This makes me want to also improve the test from #13369 to add an assertNull(onlyReader.getPointValues("field"));, could you do it as part of this PR? The connection with your PR is that we're not writing empty fields, so getting a PointValues instance should return null, not an empty instance.

++ that makes sense. Nice to assert this. Done.

@ChrisHegarty ChrisHegarty merged commit 731cecf into apache:main May 16, 2024
3 checks passed
@ChrisHegarty ChrisHegarty deleted the fix_write_no_points branch May 16, 2024 13:24
ChrisHegarty added a commit to ChrisHegarty/lucene that referenced this pull request May 16, 2024
This commit updates the writer to handle the case where there are no values.

Previously (before apache#13369), there was a check that there were some points values before trying to write, this is no longer the case. The code in writeFieldNDims has an assumption that the values is not empty - an empty values will result in calculating a negative number of splits, and a negate array size to hold the splits.

The fix is trivial, return null when values is empty - null is an allowable return value from this method. Note: writeField1Dim is able to handle an empty values.
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.

Reproducible failure TestIndexWriterExceptions2.testBasics
4 participants