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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public DocIndexIterator iterator() {

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public DocIndexIterator iterator() {

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public int ordToDoc(int ord) {

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public DocIndexIterator iterator() {

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public int ordToDoc(int ord) {

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

@Override
Expand Down
Loading