You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/03/04 09:14:56 UTC

[GitHub] [druid] clintropolis commented on a change in pull request #10697: Supporting filters in the left base table for join datasources

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org