clintropolis commented on a change in pull request #10697:
URL: https://github.com/apache/druid/pull/10697#discussion_r586931990



##########
File path: 
processing/src/main/java/org/apache/druid/query/planning/DataSourceAnalysis.java
##########
@@ -98,12 +102,13 @@ private DataSourceAnalysis(
     this.dataSource = dataSource;
     this.baseDataSource = baseDataSource;
     this.baseQuery = baseQuery;
+    this.joinBaseTableFilter = joinBaseTableFilter;
     this.preJoinableClauses = preJoinableClauses;
   }
 
   public static DataSourceAnalysis forDataSource(final DataSource dataSource)
   {
-    // Strip outer queries, retaining querySegmentSpecs as we go down (lowest 
will become the 'baseQuerySegmentSpec').
+    // Strip outer queries, retaining querySegmentSpecs as we go down (lowest 
will become the 'baseQuerySegmentSpec'o).

Review comment:
       this was probably an accident?

##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java
##########
@@ -648,6 +651,52 @@ private VirtualColumns getVirtualColumns(final boolean 
includeDimensions)
     return VirtualColumns.create(columns);
   }
 
+  /**
+   * Returns a pair of DataSource and Filtration object created on the query 
filter. In case the, data source is
+   * a join datasource, the datasource may be altered and left filter of join 
datasource may
+   * be rid of time filters.
+   * TODO: should we optimize the base table filter just like we do with query 
filters
+   */
+  @VisibleForTesting
+  static Pair<DataSource, Filtration> getFiltration(
+      DataSource dataSource,
+      DimFilter filter,
+      VirtualColumnRegistry virtualColumnRegistry
+  )
+  {
+    if (!(dataSource instanceof JoinDataSource)) {
+      return Pair.of(dataSource, toFiltration(filter, virtualColumnRegistry));
+    }
+    JoinDataSource joinDataSource = (JoinDataSource) dataSource;
+    if (joinDataSource.getLeftFilter() == null) {
+      return Pair.of(dataSource, toFiltration(filter, virtualColumnRegistry));
+    }
+    //TODO: We should avoid promoting the time filter as interval for right 
outer and full outer joins. This is not
+    // donw now as we apply the intervals to left base table today 
irrespective of the join type.

Review comment:
       nit: typo `donw` -> `done`?




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

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