Jackie-Jiang commented on code in PR #20331:
URL: https://github.com/apache/pinot/pull/20331#discussion_r4673520175


##########
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:
   Optional: add `column1 < 5` to both new regression tests, expecting `5L * 
NUM_OF_SEGMENT_COPIES` in each. This predicate matches the stored null 
sentinel, so it directly verifies that the outer filter removes the null row 
from the combined range result. The current positive predicates naturally 
exclude the sentinel, while `NOT >` exercises the not-false/complement path.



##########
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:
   Optional wording cleanup: say that `BaseColumnFilterOperator` handles null 
semantics on the combined result. That covers both `getTrues()` (excludes 
nulls) and `getNotFalses()` (unions nulls for negation), whereas "the caller 
takes the null rows out" only describes the positive-filter path. The 
explanation about preserving `ScanBasedDocIdIterator` is useful to retain.



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