adrien-grl commented on code in PR #51631:
URL: https://github.com/apache/arrow/pull/51631#discussion_r4132941151
##########
python/pyarrow/io.pxi:
##########
@@ -193,6 +193,20 @@ cdef class NativeFile(_Weakrefable):
else:
check_status(self.output_stream.get().Close())
+ def abort(self):
+ """
+ Close the stream, discarding written data if the stream supports it.
+
+ For example, an S3 output stream aborts its multipart upload, so no
+ object is written. Other streams are simply closed.
+ """
+ if not self.closed:
+ with nogil:
+ if self.is_readable:
+ check_status(self.input_stream.get().Abort())
+ else:
+ check_status(self.output_stream.get().Abort())
Review Comment:
Reproduced locally with a MinIO user with `s3:PutObject` but not
`s3:AbortMultipartUpload`. Fixed by marking the stream as closed before sending
the abort request. `test_s3_output_stream_failed_abort` covers it.
--
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]