richardstartin commented on code in PR #9453:
URL: https://github.com/apache/pinot/pull/9453#discussion_r978569589
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/BitSlicedRangeIndexReader.java:
##########
@@ -122,35 +157,39 @@ public ImmutableRoaringBitmap
getPartiallyMatchingDocIds(double min, double max)
}
private ImmutableRoaringBitmap queryRangeBitmap(long min, long max, long
columnMax) {
- RangeBitmap rangeBitmap = mapRangeBitmap();
- if (Long.compareUnsigned(max, columnMax) < 0) {
- if (Long.compareUnsigned(min, 0) > 0) {
- return rangeBitmap.between(min, max).toMutableRoaringBitmap();
- }
- return rangeBitmap.lte(max).toMutableRoaringBitmap();
- } else {
- if (Long.compareUnsigned(min, 0) > 0) {
- return rangeBitmap.gte(min).toMutableRoaringBitmap();
- }
+ // Compare unsigned
+ boolean lowerUnbounded = min + Long.MIN_VALUE <= Long.MIN_VALUE;
+ boolean upperUnbounded = max + Long.MIN_VALUE >= columnMax +
Long.MIN_VALUE;
+ if (lowerUnbounded && upperUnbounded) {
MutableRoaringBitmap all = new MutableRoaringBitmap();
- all.add(0, _numDocs);
+ all.add(0L, _numDocs);
return all;
}
+ RangeBitmap rangeBitmap = mapRangeBitmap();
+ if (lowerUnbounded) {
+ return rangeBitmap.lte(max).toMutableRoaringBitmap();
+ }
+ if (upperUnbounded) {
+ return rangeBitmap.gte(min).toMutableRoaringBitmap();
+ }
+ return rangeBitmap.between(min, max).toMutableRoaringBitmap();
Review Comment:
The data structure already detects these cases and skips them, the mapping
should take ~10ns and eliminating that should be balanced against needing to
read the code
--
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]