EdisonWang created SPARK-30088:
----------------------------------

             Summary: Adaptive execution should convert SortMergeJoin to 
BroadcastJoin when plan generates empty result
                 Key: SPARK-30088
                 URL: https://issues.apache.org/jira/browse/SPARK-30088
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 3.0.0
            Reporter: EdisonWang


Adaptive execution try to  convert SortMergeJoin to BroadcastJoin by checking 
the `dataSize` metrics of spark plan. However, if the spark plan generates 
empty result, the `dataSize` metrics is empty due to SQLMetrics's initial value 
is -1, which could lead to the following check return false

```

private def canBroadcast(plan: LogicalPlan): Boolean = {
 plan.stats.sizeInBytes >= 0 && plan.stats.sizeInBytes <= 
conf.autoBroadcastJoinThreshold
}

```



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to