Indian-boult opened a new issue, #20330:
URL: https://github.com/apache/pinot/issues/20330

   A range predicate on a column with a version 1 range index fails when the 
query enables null handling and the column holds a null. Multi-value columns 
always get the version 1 index, so a range filter on any nullable multi-value 
column with a range index hits this. A single-value column hits it when 
`rangeIndexVersion` is 1.
   
   Repro on master with a multi-value INT column that has a range index and one 
null row.
   
       SET enableNullHandling = true;
       SELECT COUNT(*) FROM testTable WHERE column1 > 4
   
       java.lang.ClassCastException: class 
org.apache.pinot.core.operator.dociditerators.RangelessBitmapDocIdIterator 
cannot be cast to class 
org.apache.pinot.core.operator.dociditerators.ScanBasedDocIdIterator
           at 
org.apache.pinot.core.operator.filter.RangeIndexBasedFilterOperator.evaluateLegacyRangeFilter(RangeIndexBasedFilterOperator.java:108)
   
   `NOT (column1 > 4)` and `BETWEEN` fail the same way. With null handling off, 
or with no null row, the same queries work.
   
   The version 1 index is not exact, so `evaluateLegacyRangeFilter` scans the 
documents of the ranges the predicate only partly covers. It gets that scan 
from `ScanBasedFilterOperator.getTrues()` and casts the iterator to 
`ScanBasedDocIdIterator`. When null handling is on and the column has nulls, 
`BaseColumnFilterOperator.getTrues()` wraps the scan in an `AndDocIdSet` with 
the non-null rows, and the iterator of that set is a bitmap iterator, so the 
cast fails. The outer operator already takes the null rows out in its own 
`getTrues()` and adds them back in `getNotFalses()`, so the inner scan only 
needs `getNextBlockWithoutNullHandling()`.
   


-- 
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]

Reply via email to