HyukjinKwon commented on a change in pull request #23760: [SPARK-26762][SQL][R]
Arrow optimization for conversion from Spark DataFrame to R DataFrame
URL: https://github.com/apache/spark/pull/23760#discussion_r257081022
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
##########
@@ -3198,9 +3199,66 @@ class Dataset[T] private[sql](
}
/**
- * Collect a Dataset as Arrow batches and serve stream to PySpark.
+ * Collect a Dataset as Arrow batches and serve stream to SparkR. It sends
+ * arrow batches in an ordered manner with buffering. This is inevitable
+ * due to missing R API that reads batches from socket directly. See
ARROW-4512.
+ * Eventually, this code should be deduplicated by `collectAsArrowToPython`.
*/
- private[sql] def collectAsArrowToPython(): Array[Any] = {
+ private[sql] def collectAsArrowToR(): Array[Any] = {
Review comment:
Yes, this was pointed out by @BryanCutler at
https://github.com/apache/spark/pull/23760#issuecomment-463012213.
This `collectAsArrowToR` was restored from the previous code (see bf2feec).
The newer code (for `collectAsArrowToPython`) has a test by using Python's RDD
APIs.
If I am not mistaken, it's difficult to write a test with R RDD API, and
we're in transition to get rid of RDD API in SparkR completely
(https://github.com/apache/spark/pull/22866).
Since this was restored almost as is from the previous code, and eventually,
this code will be deduplicated by `collectAsArrowToPython` after Arrow 0.14.0
release (this logic is restored mainly due to ARROW-4512), I hope end-to-end
tests only are okay enough.
Since it's being tested via Python RDD API, we could deduplicate the tests
too after Arrow 0.14.0 release. Does that make sense to you?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]