-
Notifications
You must be signed in to change notification settings - Fork 332
Added force virtual addressing configuration for S3, Alibaba OSS protocol to use PyArrowFileIO #1392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added force virtual addressing configuration for S3, Alibaba OSS protocol to use PyArrowFileIO #1392
Changes from 1 commit
5b24172
360e305
31291f4
6575552
282bd47
7315525
727666d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,7 @@ | |
S3_ROLE_SESSION_NAME, | ||
S3_SECRET_ACCESS_KEY, | ||
S3_SESSION_TOKEN, | ||
S3_FORCE_VIRTUAL_ADDRESSING, | ||
FileIO, | ||
InputFile, | ||
InputStream, | ||
|
@@ -350,7 +351,7 @@ def parse_location(location: str) -> Tuple[str, str, str]: | |
return uri.scheme, uri.netloc, f"{uri.netloc}{uri.path}" | ||
|
||
def _initialize_fs(self, scheme: str, netloc: Optional[str] = None) -> FileSystem: | ||
if scheme in {"s3", "s3a", "s3n"}: | ||
if scheme in {"s3", "s3a", "s3n", "oss", "r2"}: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Plugging out R2. It uses account ID to create the URL, which is quite different from how S3 natively set the virtual hosted style. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for testing it out! do you mind editing the PR description and mention this PR only supports oss |
||
from pyarrow.fs import S3FileSystem | ||
|
||
client_kwargs: Dict[str, Any] = { | ||
|
@@ -373,6 +374,9 @@ def _initialize_fs(self, scheme: str, netloc: Optional[str] = None) -> FileSyste | |
if session_name := get_first_property_value(self.properties, S3_ROLE_SESSION_NAME, AWS_ROLE_SESSION_NAME): | ||
client_kwargs["session_name"] = session_name | ||
|
||
if force_virtual_addressing := self.properties.get(S3_FORCE_VIRTUAL_ADDRESSING): | ||
client_kwargs["force_virtual_addressing"] = property_as_bool(self.properties, force_virtual_addressing, False) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
return S3FileSystem(**client_kwargs) | ||
elif scheme in ("hdfs", "viewfs"): | ||
from pyarrow.fs import HadoopFileSystem | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: perhaps just copy/paste S3FileSystem docs
https://arrow.apache.org/docs/python/generated/pyarrow.fs.S3FileSystem.html