richardstartin commented on code in PR #9453:
URL: https://github.com/apache/pinot/pull/9453#discussion_r978444007
##########
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:
The check for `min > _max || max < _min` is critical and can only be
performed here for raw columns. However, ranges with `min > max` making it down
to this level is a problem with the query planner and should be fixed there
(even on the broker)
--
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]