You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/02/18 19:51:50 UTC

[GitHub] dilipbiswal commented on a change in pull request #23822: [MINOR][DOC] Add note regarding proper usage of QueryExecution.toRdd

dilipbiswal commented on a change in pull request #23822: [MINOR][DOC] Add note regarding proper usage of QueryExecution.toRdd
URL: https://github.com/apache/spark/pull/23822#discussion_r257810361
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala
 ##########
 @@ -85,7 +85,14 @@ class QueryExecution(
     prepareForExecution(sparkPlan)
   }
 
-  /** Internal version of the RDD. Avoids copies and has no schema */
+  /**
+   * Internal version of the RDD. Avoids copies and has no schema.
+   * Note for callers: Spark may apply various optimization including reusing object: this means
+   * the row is valid only for the iteration it is retrieved. You should avoid storing row and
+   * accessing after iteration. (Calling `collect()` is one of known bad usage.)
+   * If you want to store these rows into collection, please apply some converter or copy row
+   * which produces new object per iteration.
+   */
 
 Review comment:
   @HeartSaVioR Should we point the users to dataset.rdd method where the conversion is already applied ?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org