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


##########
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())) {

Review Comment:
   I meant that when a cluster group tuple has a part defined by a virtual 
column, we should be able to prune on that part if it's referenced either using 
a query-time virtual column, or referenced directly. To me it looks like the 
current code only works if it's referenced through a query-time virtual column.
   
   The scenario I'm talking about is like:
   
   - cluster group key is `(vdim1)` defined as `concat(dim1, 'foo')`
   - we have a segment using that cluster group config, with cluster groups 
`('abcfoo')` and `('deffoo')`
   - query `WHERE CONCAT(dim1, 'foo') = 'barfoo'` should prune out this segment
   - query `WHERE vdim1 = 'barfoo'` should *also* prune out this segment



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