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 acceptOrds in EmptyOffHeapVectorValues to match no bits #14119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vigyasharma
Copy link
Contributor

EmptyOffHeapVectorValues currently returns null for getAcceptOrds(). However, internally across the codebase, we assume that null Bits imply that all values are accepted – like null for acceptDocs() or live docs.
Since EmptyOffHeapVectorValues have not vectors, they should really reject all ordinals.

This doesn't have much impact because I don't see much usage of Empty VectorValues. But it's good to clean up and keep assumptions consistent.

@@ -256,7 +256,7 @@ public DocIndexIterator iterator() {

@Override
public Bits getAcceptOrds(Bits acceptDocs) {
return null;
return new Bits.MatchNoBits(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

pedantically, shouldn't this return null for a null input?

if (acceptDocs == null) {
  return null;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm.. how should this API behave is a document is accepted but does not have a vector ordinal? My understanding is that Bits#get(int ord) should return false.. It should be true only when the doc is accepted and it has a vector ordinal.

A null return value accepts all ordinals. This is okay for dense vectors if acceptDocs is null, but not for Empty and Sparse. Speaking of which, we should probably also have this check for Sparse Vector Values. Suppose our max ordinal today is N. Today the behavior for acceptOrd().get(N+1) changes depending on whether acceptDocs is null or not. It should always be false.

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.

2 participants