Github user ericl commented on a diff in the pull request:
https://github.com/apache/spark/pull/12425#discussion_r59963085
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/ShuffleExchange.scala
---
@@ -78,8 +82,15 @@ case class ShuffleExchange(
* the returned ShuffleDependency will be the input of shuffle.
*/
private[sql] def prepareShuffleDependency(): ShuffleDependency[Int,
InternalRow, InternalRow] = {
- ShuffleExchange.prepareShuffleDependency(
- child.execute(), child.output, newPartitioning, serializer)
+ val dataSize = longMetric("dataSize")
+ val rdd = child.execute().mapPartitionsInternal { iter =>
+ val localDataSize = dataSize.localValue
+ iter.map { row =>
+ localDataSize.add(row.asInstanceOf[UnsafeRow].getSizeInBytes)
--- End diff --
Isn't this iteration over each row a significant added overhead? Seems it
would be better to count the data size in bulk instead where the sort is done.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]