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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]