FrankChen021 commented on code in PR #20149:
URL: https://github.com/apache/druid/pull/20149#discussion_r3862687386


##########
processing/src/main/java/org/apache/druid/query/filter/FilterSegmentPruner.java:
##########
@@ -164,10 +201,37 @@ public String toString()
            '}';
   }
 
+  /**
+   * Adds the filter's {@link RangeSet} for {@code column} to {@code 
filterDomain}, resolving through
+   * {@code domainVirtualColumns} to the query's equivalent virtual column if 
{@code column} is virtual there.
+   */
+  private void addToFilterDomain(
+      String column,
+      VirtualColumns domainVirtualColumns,
+      Map<String, RangeSet<String>> filterDomain
+  )
+  {
+    final VirtualColumns.Node domainNode = 
domainVirtualColumns.getNode(column);
+    if (domainNode != null) {
+      final VirtualColumn queryEquivalent = getQueryEquivalent(domainNode);
+      if (queryEquivalent != null && 
filterFields.contains(queryEquivalent.getOutputName())) {
+        final Optional<RangeSet<String>> optFilterRangeSet = 
rangeCache.computeIfAbsent(
+            queryEquivalent.getOutputName(),
+            d -> Optional.ofNullable(filter.getDimensionRangeSet(d))
+        );
+        optFilterRangeSet.ifPresent(rangeSet -> filterDomain.put(column, 
rangeSet));
+      }
+    } else if (filterFields.contains(column)) {

Review Comment:
   [P1] Ignores query-VC shadowing of physical cluster columns
   
   When a query virtual column has the same name as a physical clustering 
column but a different expression, query VCs shadow physical columns. This 
branch still applies the filter range to the physical tuple value, so a segment 
can be pruned even though the virtual expression matches rows inside it. 
Resolve query virtual columns first and only use direct tuple matching when no 
query VC shadows the name; add a regression test.



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