Repository navigation
Add s3.allow-delayed-open property for PyArrowFileIO - #4518
Merged
Merged
Conversation
pyarrow's S3 output stream starts a multipart upload when a file is opened unless S3FileSystem(allow_delayed_open=True) is set, so every object PyArrowFileIO writes (manifests, manifest lists, metadata.json) costs CreateMultipartUpload + UploadPart + CompleteMultipartUpload. With the flag on, objects under the 10 MiB part size go out as a single PutObject. pyarrow exposes the option from 21.0.0, so the property is guarded the same way as s3.ssl.ca-cert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fokko
approved these changes
Nov 29, 2026
Fokko
left a comment
Contributor
There was a problem hiding this comment.
Nice add, thanks @dor-bernstein
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
PyArrowFileIObuildspyarrow.fs.S3FileSystemwithoutallow_delayed_open, which defaults toFalse. With that default, Arrow's S3 output stream callsCreateMultipartUploadas soon as a file is opened (s3fs.cc,ObjectOutputStream::Init). Every object pyiceberg writes, including a 2 KB manifest list, then costs three requests:CreateMultipartUpload,UploadPartandCompleteMultipartUpload.With
allow_delayed_open=True, Arrow defers the upload, and objects under the 10 MiB part size are sent as a singlePutObjecton close. Manifests, manifest lists andmetadata.jsonare almost always under that size, so on a write-heavy table this cuts the S3 write requests of a commit by roughly two-thirds. We measured this in S3 server access logs: about 1.07 parts per multipart upload, so the Create/Complete pair is nearly all overhead.This PR adds an
s3.allow-delayed-openFileIO property that is passed through toS3FileSystemfors3://andoss://. pyarrow exposes the option from 21.0.0, so the property uses the same version guard ass3.ssl.ca-cert. When it is unset, nothing changes.The trade-off, from the pyarrow docs, is that errors that would surface on open, such as a missing bucket, are reported on write or close instead.
Are these changes tested?
Yes. There are unit tests in
tests/io/test_pyarrow.pyfor:true/falsereachingS3FileSystemfors3://, andtruefoross://ImportErroron pyarrow < 21Are there any user-facing changes?
Yes: a new optional FileIO property,
s3.allow-delayed-open, documented inconfiguration.md. The default behavior is unchanged.🤖 Generated with Claude Code