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 2020/05/08 03:35:02 UTC

[GitHub] [druid] maytasm commented on a change in pull request #9773: Bad plan for table-lookup-lookup join with filter on first lookup and outer limit

maytasm commented on a change in pull request #9773:
URL: https://github.com/apache/druid/pull/9773#discussion_r421917928



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidJoinQueryRel.java
##########
@@ -293,23 +293,17 @@ protected RelDataType deriveRowType()
   @Override
   public RelOptCost computeSelfCost(final RelOptPlanner planner, final RelMetadataQuery mq)
   {
-    double cost;
-
-    if (computeLeftRequiresSubquery(getSomeDruidChild(left))) {
-      cost = CostEstimates.COST_JOIN_SUBQUERY;
-    } else {
-      cost = partialQuery.estimateCost();
-    }
-
-    if (computeRightRequiresSubquery(getSomeDruidChild(right))) {
-      cost += CostEstimates.COST_JOIN_SUBQUERY;
-    }
-
+    double cost = partialQuery.estimateCost();
     if (joinRel.getCondition().isA(SqlKind.LITERAL) && !joinRel.getCondition().isAlwaysFalse()) {
       cost += CostEstimates.COST_JOIN_CROSS;
     }
-
-    return planner.getCostFactory().makeCost(cost, 0, 0);
+    // This is to cancel out the MULTIPLIER_FILTER (value=0.1) from partialQuery.estimateCost() to discourage
+    // filter push down if pushing down the filter makes this DruidJoinQueryRel not a scan or mapping.
+    // This will leave the filter at the topmost DruidJoinQueryRel (due to the order of applying/popping rules).

Review comment:
       Done. Updated PR description with details.




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