You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/12/03 08:41:10 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #26726: [SPARK-30088][SQL]Adaptive execution should convert SortMergeJoin to BroadcastJoin when plan generates empty result

cloud-fan commented on a change in pull request #26726: [SPARK-30088][SQL]Adaptive execution should convert SortMergeJoin to BroadcastJoin when plan generates empty result
URL: https://github.com/apache/spark/pull/26726#discussion_r353043346
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/QueryStageExec.scala
 ##########
 @@ -79,7 +79,9 @@ abstract class QueryStageExec extends LeafExecNode {
    */
   def computeStats(): Option[Statistics] = resultOption.map { _ =>
     // Metrics `dataSize` are available in both `ShuffleExchangeExec` and `BroadcastExchangeExec`.
-    Statistics(sizeInBytes = plan.metrics("dataSize").value)
+    // The `dataSize` metric may be a negative number when this spark plan generates empty result,
+    // since SQLMetric use -1 as initial value.
+    Statistics(sizeInBytes = Math.max(plan.metrics("dataSize").value, 0))
 
 Review comment:
   This is a bug of the `dataSize` metrics, not AQE, let's fix the underlying issue.
   
   Can you take over https://github.com/apache/spark/pull/25095 ?

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org