HeartSaVioR 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_r257817130
##########
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:
Yeah that's good suggestion for end users (not Spark developers). Will add.
----------------------------------------------------------------
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]