Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/5279#discussion_r27488228
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala ---
@@ -937,7 +937,10 @@ class DataFrame private[sql](
def rdd: RDD[Row] = {
// use a local variable to make sure the map closure doesn't capture
the whole DataFrame
val schema = this.schema
-
queryExecution.executedPlan.execute().map(ScalaReflection.convertRowToScala(_,
schema))
+ queryExecution.executedPlan.execute().mapPartitions(rows => {
+ val converters = ScalaReflection.createConvertersForStruct(schema)
+ rows.map(ScalaReflection.convertRowToScalaWithConverters(_, schema,
converters))
+ })
--- End diff --
Similar to the `case` clause in pattern matching, we usually use
```scala
.mapPartitions { rows =>
...
}
```
or
```scala
.mapPartitions(rows => ...)
```
---
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]