Skip to content

Commit 19c46c3

Browse files
Jonathan Ellismike-tr-adamson
authored andcommitted
special case bitsPerValue == 0
1 parent 0774345 commit 19c46c3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/java/org/apache/cassandra/index/sai/disk/v1/postings/PostingsReader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public BlocksSummary(IndexInput input, long offset) throws IOException
118118
String.format("Postings list header is corrupted: Bits per value for block offsets is %s. Supported values are %s.",
119119
offsetBitsPerValue, DirectReaders.SUPPORTED_BITS_PER_VALUE_STRING), input);
120120
}
121-
this.offsets = new LongArrayReader(randomAccessInput, DirectReader.getInstance(randomAccessInput, offsetBitsPerValue, input.getFilePointer()), numBlocks);
121+
this.offsets = new LongArrayReader(randomAccessInput, offsetBitsPerValue == 0 ? LongValues.ZEROES : DirectReader.getInstance(randomAccessInput, offsetBitsPerValue, input.getFilePointer()), numBlocks);
122122

123123
input.seek(maxBlockValuesOffset);
124124
byte valuesBitsPerValue = input.readByte();
@@ -128,7 +128,7 @@ public BlocksSummary(IndexInput input, long offset) throws IOException
128128
String.format("Postings list header is corrupted: Bits per value for value samples is %s. Supported values are %s.",
129129
valuesBitsPerValue, DirectReaders.SUPPORTED_BITS_PER_VALUE_STRING), input);
130130
}
131-
this.maxValues = new LongArrayReader(randomAccessInput, DirectReader.getInstance(randomAccessInput, valuesBitsPerValue, input.getFilePointer()), numBlocks);
131+
this.maxValues = new LongArrayReader(randomAccessInput, valuesBitsPerValue == 0 ? LongValues.ZEROES : DirectReader.getInstance(randomAccessInput, valuesBitsPerValue, input.getFilePointer()), numBlocks);
132132
}
133133

134134
void close()

0 commit comments

Comments
 (0)