[ 
https://issues.apache.org/jira/browse/SPARK-61549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Peter Toth updated SPARK-61549:
-------------------------------
    Affects Version/s: 4.4.0
                           (was: 4.0.0)

> Estimate the size of a single join from its left side
> -----------------------------------------------------
>
>                 Key: SPARK-61549
>                 URL: https://issues.apache.org/jira/browse/SPARK-61549
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 4.4.0
>            Reporter: Peter Toth
>            Priority: Major
>
> The size estimate of a logical join of type {{LeftSingle}} is the product of 
> the sizes of its two sides. {{SizeInBytesOnlyStatsPlanVisitor.visitJoin}} 
> falls back to {{default}} for it, which multiplies the sizes of the children. 
> CBO's {{JoinEstimation}} does not support {{LeftSingle}} either, so it falls 
> back to the same product.
> A single join outputs each row of its left side once, with the columns of the 
> right side added. They are null when no row matches, and the join fails on a 
> second match. So its row count is the left side's.
> {{RewriteCorrelatedScalarSubquery}} plans a single join for a correlated 
> scalar subquery that the optimizer cannot prove to return one row 
> ({{spark.sql.optimizer.scalarSubqueryUseSingleJoin}}, true by default). The 
> joins above it see that side as far bigger than it is, and can miss a 
> broadcast.
> Estimating it from its left side, as SPARK-61534 does for an existence join, 
> would fix it.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to