clintropolis commented on code in PR #17084:
URL: https://github.com/apache/druid/pull/17084#discussion_r1762645130


##########
processing/src/main/java/org/apache/druid/segment/VirtualColumns.java:
##########
@@ -172,10 +174,28 @@ public VirtualColumn getVirtualColumn(String columnName)
     if (vc != null) {
       return vc;
     }
+    if (hasNoDotColumns) {
+      return null;
+    }
     final String baseColumnName = splitColumnName(columnName).lhs;
     return withDotSupport.get(baseColumnName);
   }
 
+  /**
+   * Check if a virtual column is already defined which is the same as some 
other virtual column, ignoring output name,
+   * returning that virtual column if it exists, or null if there is no 
equivalent virtual column.
+   */
+  @Nullable
+  public VirtualColumn findEquivalent(VirtualColumn virtualColumn)

Review Comment:
   perhaps the context of why I am adding this method is missing. I'm working 
on a feature called projections, which allows transformed and pre-aggregated 
data to exist on top of a base segment, and automatically be used by a query 
against the base. Part of the needs of this is to match up virtual columns 
present in the query to those present in the projections, so if a table exists 
that already contains the transform we can use it and map projected virtual 
column to the query virtual column to skip having to compute it. I don't 
actually want to add this virtual column to `VirtualColumns`, though I should 
probably precompute an equivalence set or something to use for better lookup.
   
   The SQL layer currently handles deduplication of expressions before creating 
VirtualColumns with `VirtualColumnRegistry`, so there isn't a super strong need 
to have the same stuff here.



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