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

Add test for float vector values in FlatVectorsScorer impls #13851

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

ChrisHegarty
Copy link
Contributor

This is a test only change that verifies the behaviour when float vector values are passed to our FlatVectorsScorer implementations. This would have caught the bug causing #13844, subsequently fixed by #13850.

Copy link
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

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

I verified that this test passes with the bug fix but fails without it.

@ChrisHegarty ChrisHegarty merged commit 4a1653c into apache:main Oct 2, 2024
3 checks passed
@ChrisHegarty ChrisHegarty deleted the test_vec branch October 2, 2024 15:05
ChrisHegarty added a commit that referenced this pull request Oct 2, 2024
This is a test only change that verifies the behaviour when float vector values are passed to our FlatVectorsScorer implementations. This would have caught the bug causing #13844, subsequently fixed by #13850.
ChrisHegarty added a commit that referenced this pull request Oct 2, 2024
This is a test only change that verifies the behaviour when float vector values are passed to our FlatVectorsScorer implementations. This would have caught the bug causing #13844, subsequently fixed by #13850.

var supplier1 = DEFAULT_SCORER.getRandomVectorScorerSupplier(sim, vectorValues);
var supplier2 = MEMSEG_SCORER.getRandomVectorScorerSupplier(sim, vectorValues);
// these assertion assumes that the supplier and scorer's toString will have float
Copy link
Contributor

Choose a reason for hiding this comment

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

"assertions assume"?

Copy link
Contributor

Choose a reason for hiding this comment

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

too bad we can't access the underlying vector values to see what its vectorEncoding is, but this checking toString() seems sort of OK?

assertEquals(scorer2.score(0), expected, DELTA);

expectThrows(
Throwable.class,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is Throwable the most specific we can assert?

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.

3 participants