windpiger commented on issue #25095: [SPARK-28332][SQL] SQLMetric wrong initValue URL: https://github.com/apache/spark/pull/25095#issuecomment-510304475 > Probably, [this work around](https://github.com/apache/spark/blob/3f375c850b5a41ae1ca5deb84fdcea667c32a032/sql/core/src/main/scala/org/apache/spark/sql/execution/metric/SQLMetrics.scala#L38) is related to the -1 value. But, this change looks reasonable to me, too. This workaround change cause a incorrect dataSize metric, If we use dataSize to do some other logical such as [used to get the statistic of QueryStageExec in AdaptiveExecutionMode](https://github.com/apache/spark/blob/cec6a329044fa7d8a4f3da3871dbacac95cc38ed/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/QueryStageExec.scala#L82), this will cause the statistic of QueryStageExec set to be a negative value, and then will miss the re-optimize (SMJ->BHJ) because the plan.stats.sizeInBytes < 0 in the [this canBroadcast method](https://github.com/apache/spark/blob/5c55812400e1e0a8aaeb50a50be106e80c916c86/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala#L144)
---------------------------------------------------------------- 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]
