Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/11664#discussion_r55956582
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkPlan.scala ---
@@ -220,7 +222,61 @@ abstract class SparkPlan extends QueryPlan[SparkPlan]
with Logging with Serializ
* Runs this query returning the result as an array.
*/
def executeCollect(): Array[InternalRow] = {
- execute().map(_.copy()).collect()
+ // Packing the UnsafeRows into byte array for faster serialization.
+ // The byte arrays are in the following format:
+ // [size] [bytes of UnsafeRow] [size] [bytes of UnsafeRow] ... [-1]
+ val byteArrayRdd = execute().mapPartitionsInternal { iter =>
+ new Iterator[Array[Byte]] {
+ private var row: UnsafeRow = _
+ override def hasNext: Boolean = row != null || iter.hasNext
+ override def next: Array[Byte] = {
--- End diff --
next() rather than next
---
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]