BryanCutler commented on a change in pull request #24677: [SPARK-27805][PYTHON]
Propagate SparkExceptions during toPandas with arrow enabled
URL: https://github.com/apache/spark/pull/24677#discussion_r288346977
##########
File path: python/pyspark/serializers.py
##########
@@ -206,13 +206,19 @@ def load_stream(self, stream):
for batch in self.serializer.load_stream(stream):
yield batch
- # load the batch order indices
- num = read_int(stream)
- batch_order = []
- for i in xrange(num):
- index = read_int(stream)
- batch_order.append(index)
- yield batch_order
+ # check success
+ success = read_bool(stream)
+ if success:
+ # load the batch order indices
+ num = read_int(stream)
+ batch_order = []
+ for i in xrange(num):
+ index = read_int(stream)
+ batch_order.append(index)
+ yield batch_order
+ else:
+ error_msg = UTF8Deserializer().loads(stream)
+ raise RuntimeError("An error occurred while collecting:
{}".format(error_msg))
Review comment:
I think the error message would be a little better like this "An error
occurred while calling ArrowCollectSerializer.load_stream: {}".format(error_msg)
----------------------------------------------------------------
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.
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]