richardstartin commented on code in PR #9453:
URL: https://github.com/apache/pinot/pull/9453#discussion_r978570681
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/BitSlicedRangeIndexReader.java:
##########
@@ -49,49 +48,85 @@ public BitSlicedRangeIndexReader(PinotDataBuffer dataBuffer,
_min = dataBuffer.getLong(offset);
offset += Long.BYTES;
_offset = offset;
- _max = metadata.hasDictionary()
- ? metadata.getCardinality() - 1
- : ((Number) metadata.getMaxValue()).longValue();
+ // TODO: Read max from header to prevent cases where max value is not
available in the column metadata
+ if (metadata.hasDictionary()) {
+ _max = metadata.getCardinality() - 1;
+ } else {
+ Number maxValue = (Number) metadata.getMaxValue();
+ _max = maxValue != null ? maxValue.longValue() : Long.MAX_VALUE;
+ }
_numDocs = metadata.getTotalDocs();
}
@Override
public int getNumMatchingDocs(int min, int max) {
+ // TODO: Handle this before reading the range index
+ if (min > max || min > _max || max < _min) {
+ return 0;
+ }
Review Comment:
Indeed, I don’t think the index should need to do these checks at all, but
if you need a quick fix maybe this is the quick solution.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]