-
Notifications
You must be signed in to change notification settings - Fork 125
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
Minor refactoring and refactored some unit test #2167
Conversation
06480d8
to
e4a8e37
Compare
e4a8e37
to
56a27f8
Compare
CHANGELOG.md
Outdated
@@ -31,3 +31,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
### Maintenance | |||
* Remove benchmarks folder from k-NN repo [#2127](https://github.com/opensearch-project/k-NN/pull/2127) | |||
### Refactoring | |||
* Update unit test to include field with no live docs and minor refactor [#2167](https://github.com/opensearch-project/k-NN/pull/2167) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would reverse this to describe the minor refact and then say "and refactor some tests"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall
verify(knn990QuantWriterMockedConstruction.constructed().get(0)).writeState(i, quantizationState); | ||
verify(nativeIndexWriter).flushIndex(expectedVectorValues.get(i), vectorsPerField.get(i).size()); | ||
if (vectorsPerField.get(i).isEmpty()) { | ||
verify(knn990QuantWriterMockedConstruction.constructed().get(0), never()).writeState(i, quantizationState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want any interactions with quantwriter in this case right?
verify(knn990QuantWriterMockedConstruction.constructed().get(0), never()).writeState(i, quantizationState); | |
verifyNoInteractions(knn990QuantWriterMockedConstruction); |
verify(nativeIndexWriter).flushIndex(expectedVectorValues.get(i), vectorsPerField.get(i).size()); | ||
if (vectorsPerField.get(i).isEmpty()) { | ||
verify(knn990QuantWriterMockedConstruction.constructed().get(0), never()).writeState(i, quantizationState); | ||
verify(nativeIndexWriter, never()).flushIndex(expectedVectorValues.get(i), vectorsPerField.get(i).size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, verifying no interactions is a much stronger check
verify(nativeIndexWriter, never()).flushIndex(expectedVectorValues.get(i), vectorsPerField.get(i).size()); | |
verifyNoInteractions(nativeIndexWriter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure will that work. We have interactions from other fields. I only want to verify that it doesn't interact when there are empty fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I missed that it has other values apart from empty vector
Refactored if/else to reduce nesting. Added unit test when one of the field doesn't have live docs. Signed-off-by: Vijayan Balasubramanian <[email protected]>
a5c6bc3
to
ee6e7ee
Compare
CI failure is not related to this PR. Created GH issue for flaky test #2169 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Refactored if/else to reduce nesting. Added unit test when one of the field doesn't have live docs. Signed-off-by: Vijayan Balasubramanian <[email protected]> (cherry picked from commit f16f225)
…) (#2170) Refactored if/else to reduce nesting. Added unit test when one of the field doesn't have live docs. Signed-off-by: Vijayan Balasubramanian <[email protected]> (cherry picked from commit f16f225) Co-authored-by: Vijayan Balasubramanian <[email protected]>
Description
Related Issues
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.