LakshSingla commented on code in PR #15020:
URL: https://github.com/apache/druid/pull/15020#discussion_r1332484316


##########
sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java:
##########
@@ -788,6 +790,24 @@ static Pair<DataSource, Filtration> getFiltration(
   {
     if (!canUseIntervalFiltering(dataSource)) {
       return Pair.of(dataSource, toFiltration(filter, 
virtualColumnRegistry.getFullRowSignature(), false));
+    } else if (dataSource instanceof UnnestDataSource) {
+      // UnnestDataSource can have another unnest data source
+      // join datasource, filtered data source, etc as base
+      Pair<DataSource, Filtration> pair = getFiltration(
+          ((UnnestDataSource) dataSource).getBase(),

Review Comment:
   We are not checking if the underlying data source can use interval 
filtering. What's the behavior when we replace the table data source with 
something like a lookup and do an unnest on that? We shouldn't call `optimize` 
in that case since lookups can't use interval filtering.
   
   Why is the `UNNEST` datasource not triggering the final `else` branch in 
this scenario if the underlying table `canUseIntervalFiltering` and the very 
first if branch if the data source can't? 



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