Skip to content

Commit

Permalink
Fix BQVectors#ramBytesUsed and BQVectors#getCompressedSize on BQVecto…
Browse files Browse the repository at this point in the history
…rs instance that is initialized but has no vectors (such as a fresh MutableBQVectors instance)
  • Loading branch information
jkni committed Feb 13, 2025
1 parent 188c216 commit 219465f
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public int getOriginalSize() {

@Override
public int getCompressedSize() {
return compressedVectors[0].length * Long.BYTES;
return bq.compressedVectorSize();
}

@Override
Expand All @@ -129,7 +129,11 @@ public BinaryQuantization getCompressor() {

@Override
public long ramBytesUsed() {
return count() * RamUsageEstimator.sizeOf(compressedVectors[0]);
long[] compressedVector = compressedVectors[0];
if (compressedVector == null) {
return 0;
}
return count() * RamUsageEstimator.sizeOf(compressedVector);
}

@Override
Expand Down

0 comments on commit 219465f

Please sign in to comment.