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

test__get_vector_similarity_query_support_true and test__get_vector_similarity_query_support_false for OpenSearchDocumentStore are flaky #3082

Closed
bogdankostic opened this issue Aug 22, 2022 · 0 comments · Fixed by #3083
Assignees
Labels
topic:tests type:bug Something isn't working

Comments

@bogdankostic
Copy link
Contributor

Describe the bug
In this test run on the main branch, the tests test__get_vector_similarity_query_support_true and test__get_vector_similarity_query_support_false failed due to an AssertionError. This error didn't occur before.

Error message

E       AssertionError: assert {'script_scor...'knn_score'}}} == {'script_scor...'knn_score'}}}
E         Differing items:
E         {'script_score': {'query': {'match_all': {}}, 'script': {'lang': 'knn', 'params': {'field': 'FooField', 'query_value': [[0.0, 8.4368011761e-313], [1.3498881881773e-311, nan]], 'space_type': 'innerproduct'}, 'source': 'knn_score'}}} != {'script_score': {'query': {'match_all': {}}, 'script': {'lang': 'knn', 'params': {'field': 'FooField', 'query_value': [[0.0, 8.4368011761e-313], [1.3498881881773e-311, nan]], 'space_type': 'innerproduct'}, 'source': 'knn_score'}}}

Additional context
This error most likely is due to the fact that we create a random numpy array here using np.ndarray. As stated in the numpy documentation, this array might contain nan values. And as stated in this section of the numpy documentation, comparing two nan values for equality will always have False as a result.

We should make sure that the randomly initialized numpy array does not contain any nan values, for example by using np.random.random_sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:tests type:bug Something isn't working
Projects
None yet
1 participant