suneet-s commented on a change in pull request #9648: SQL: More straightforward
handling of join planning.
URL: https://github.com/apache/druid/pull/9648#discussion_r406486823
##########
File path:
sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidJoinQueryRel.java
##########
@@ -336,10 +293,23 @@ protected RelDataType deriveRowType()
@Override
public RelOptCost computeSelfCost(final RelOptPlanner planner, final
RelMetadataQuery mq)
{
- return planner.getCostFactory()
- .makeCost(partialQuery.estimateCost(), 0, 0)
- .multiplyBy(leftRequiresSubquery ?
CostEstimates.MULTIPLIER_JOIN_SUBQUERY : 1)
- .multiplyBy(rightRequiresSubquery ?
CostEstimates.MULTIPLIER_JOIN_SUBQUERY : 1);
+ double cost;
+
+ if (computeLeftRequiresSubquery(getSomeDruidChild(left))) {
+ cost = CostEstimates.COST_JOIN_SUBQUERY;
+ } else {
+ cost = partialQuery.estimateCost();
+ }
+
+ if (computeRightRequiresSubquery(getSomeDruidChild(right))) {
+ cost += CostEstimates.COST_JOIN_SUBQUERY;
+ }
+
+ if (joinRel.getCondition().isA(SqlKind.LITERAL) &&
!joinRel.getCondition().isAlwaysFalse()) {
+ cost += CostEstimates.COST_JOIN_CROSS;
+ }
Review comment:
ah makes sense
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]