raghavyadav01 commented on code in PR #20331:
URL: https://github.com/apache/pinot/pull/20331#discussion_r4672593995


##########
pinot-core/src/test/java/org/apache/pinot/queries/NullHandlingEnabledQueriesTest.java:
##########
@@ -382,6 +382,31 @@ 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);

Review Comment:
   The description also covers single-value columns with `rangeIndexVersion` 1. 
Is that path covered by a test, or only the multi-value case here?



##########
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
+    // into a doc id set whose iterator is not a ScanBasedDocIdIterator.
     ScanBasedFilterOperator scanBasedFilterOperator =
         new ScanBasedFilterOperator(_queryContext, _predicateEvaluator, 
_dataSource, _numDocs);
-    BlockDocIdSet scanBasedDocIdSet = scanBasedFilterOperator.getTrues();
+    BlockDocIdSet scanBasedDocIdSet = 
scanBasedFilterOperator.getNextBlockWithoutNullHandling();

Review Comment:
   `H3IndexFilterOperator.getFilterBlock` casts 
`ExpressionFilterOperator.getTrues().iterator()` to `ScanBasedDocIdIterator` 
the same way. Can null handling wrap that result in an `AndDocIdSet` as well, 
or is it safe there?



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