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



##########
File path: python/pyspark/sql/session.py
##########
@@ -697,12 +712,19 @@ 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)
+        if isinstance(data, RDD) and no_need_to_prepare:
+            rdd, schema = self._createFromRDD(
+                data, schema, verifySchema, samplingRatio)
+        elif isinstance(data, RDD) and (not no_need_to_prepare):
+            rdd, schema = self._createFromRDD(
+                data.map(prepare), schema, verifySchema, samplingRatio)

Review comment:
       Refactored, thanks!




-- 
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