Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/1023#discussion_r13782641
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/SchemaRDD.scala ---
@@ -343,16 +343,11 @@ class SchemaRDD(
val pickle = new Pickler
iter.map { row =>
val map: JMap[String, Any] = new java.util.HashMap
- // TODO: We place the map in an ArrayList so that the object is
pickled to a List[Dict].
- // Ideally we should be able to pickle an object directly into a
Python collection so we
- // don't have to create an ArrayList every time.
- val arr: java.util.ArrayList[Any] = new java.util.ArrayList
row.zip(fieldNames).foreach { case (obj, name) =>
map.put(name, obj)
}
- arr.add(map)
- pickle.dumps(arr)
- }
+ map
+ }.grouped(10).map(batched => pickle.dumps(batched.toArray))
--- End diff --
Do you know if grouped is stream based or does it materialize the whole
thing in memory? If it is the latter, we should rewrite it to to be stream
based.
---
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.
---