viirya commented on a change in pull request #22807: 
[WIP][SPARK-25811][PySpark] Raise a proper error when unsafe cast is detected 
by PyArrow
URL: https://github.com/apache/spark/pull/22807#discussion_r245878286
 
 

 ##########
 File path: python/pyspark/serializers.py
 ##########
 @@ -284,7 +284,14 @@ def create_array(s, t):
         elif LooseVersion(pa.__version__) < LooseVersion("0.11.0"):
             # TODO: see ARROW-1949. Remove when the minimum PyArrow version 
becomes 0.11.0.
             return pa.Array.from_pandas(s, mask=mask, type=t)
-        return pa.Array.from_pandas(s, mask=mask, type=t, safe=False)
+        try:
+            array = pa.Array.from_pandas(s, mask=mask, type=t, safe=True)
+        except pa.ArrowException as e:
 
 Review comment:
   @BryanCutler Now it catches `ArrowException`.

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

Reply via email to