Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/11347#discussion_r54324424
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala ---
@@ -1753,15 +1753,26 @@ class DataFrame private[sql](
* Converts a JavaRDD to a PythonRDD.
*/
protected[sql] def javaToPython: JavaRDD[Array[Byte]] = {
- val structType = schema // capture it for closure
- val rdd = queryExecution.toRdd.map(EvaluatePython.toJava(_,
structType))
- EvaluatePython.javaToPython(rdd)
+ if (isOutputPickled) {
+ queryExecution.toRdd.map(_.getBinary(0))
--- End diff --
I introduced this for aggregate at first.
Think about `ds.map(...).groupByKey(key_func, key_schema).mapGroups(...)`,
when do aggregate, we need to run the key function and append key data to the
input rows. In this case, the input rows are the python data after `map`. So we
need to store the python data at JVM side even without schema, but the row
count should be corrected.
It's also more clear when we call `ds.map(...).count()`, users would expect
same row count after typed operations.
---
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]