Indian-boult commented on code in PR #20331:
URL: https://github.com/apache/pinot/pull/20331#discussion_r4673647459
##########
pinot-core/src/test/java/org/apache/pinot/queries/NullHandlingEnabledQueriesTest.java:
##########
@@ -382,6 +383,64 @@ public void
testFastFilteredCountExcludesNullsOnMultiValueColumn()
assertEquals(getRows(String.format("SELECT COUNT(*) FROM testTable WHERE
NOT (%s = 2)", COLUMN1)).get(0)[0], 0L);
}
+ /// A multi-value column always gets the legacy range index, which is not
exact: the documents of a range that the
+ /// predicate covers only in part are found by a scan. The null row is left
out once, from the combined result.
+ @Test
+ public void testRangeFilterOnMultiValueColumnWithLegacyRangeIndex()
+ throws Exception {
+ initializeRows();
+ for (int i = 0; i < 30; i++) {
+ insertRow(new Object[]{i, i + 1});
+ }
+ insertRow(null);
+ Schema schema = schemaBuilder().addMultiValueDimension(COLUMN1,
DataType.INT).build();
+ setUpSegments(TABLE_CONFIG_WITH_RANGE_INDEX_COLUMN, schema);
+
+ // Rows 4 to 29 hold a value above 4
+ assertEquals(getRows(String.format("SELECT COUNT(*) FROM testTable WHERE
%s > 4", COLUMN1)).get(0)[0],
Review Comment:
Added `column1 < 5` to both tests in 54b4867917, expecting 5 rows per
segment copy in each. Thanks, that one checks the null row directly since its
stored default value is below 5.
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/filter/RangeIndexBasedFilterOperator.java:
##########
@@ -101,10 +101,12 @@ private BlockDocIdSet evaluateLegacyRangeFilter() {
if (partialMatches == null) {
return matches != null ? BitmapDocIdSet.create(matches, _numDocs) :
EmptyDocIdSet.unscanned();
}
- // Need to scan the first and last range as they might be partially matched
+ // Need to scan the first and last range as they might be partially
matched. Scan without null handling because the
+ // caller takes the null rows out of the combined result, and doing it in
the scan as well wraps the scan result
Review Comment:
Reworded in 54b4867917. The comment now says `BaseColumnFilterOperator`
applies the null semantics to the combined result, and keeps the part about the
`ScanBasedDocIdIterator`.
--
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]