darcy-shen commented on a change in pull request #32332:
URL: https://github.com/apache/spark/pull/32332#discussion_r679575072



##########
File path: python/pyspark/sql/session.py
##########
@@ -697,12 +712,17 @@ def prepare(obj):
                 verify_func(obj)
                 return obj,
         else:
+            no_need_to_prepare = True
             prepare = lambda obj: obj
 
         if isinstance(data, RDD):
-            rdd, schema = self._createFromRDD(data.map(prepare), schema, 
samplingRatio)
+            rdd, schema = self._createFromRDD(
+                data if no_need_to_prepare else data.map(prepare),

Review comment:
       There are cases when verifySchema is True and the `prepare` function is 
the identity function.
   
   That's why we need the `no_need_to_prepare` flag.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to