-
Notifications
You must be signed in to change notification settings - Fork 332
Support ADLS with Pyarrow file IO #2111
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
Merged
kevinjqliu
merged 13 commits into
apache:main
from
NikitaMatskevich:nmatckevich/support-adls-pyarrow-file-io
Jun 20, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
494f2fe
bump pyarrow version deps
NikitaMatskevich 5efd4ee
add support for pyarrow adls file io
NikitaMatskevich 076b68b
modify poetry lock
NikitaMatskevich 9a8ce25
revert
NikitaMatskevich f609160
make lint
NikitaMatskevich 9667b31
check for pyarrow version dynamically
NikitaMatskevich 3ab3e99
revert poetry lock
NikitaMatskevich 018125f
Update tests/conftest.py
NikitaMatskevich d96f858
revert skip
NikitaMatskevich 7e513eb
add docs for new properties of adls
NikitaMatskevich 3e36526
revert skip tests
NikitaMatskevich 5a6dd72
inline pyarrow version def
NikitaMatskevich dae20c8
make lint
kevinjqliu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,13 @@ | |
) | ||
from pyiceberg.expressions.visitors import visit as boolean_expression_visit | ||
from pyiceberg.io import ( | ||
ADLS_ACCOUNT_KEY, | ||
ADLS_ACCOUNT_NAME, | ||
ADLS_BLOB_STORAGE_AUTHORITY, | ||
ADLS_BLOB_STORAGE_SCHEME, | ||
ADLS_DFS_STORAGE_AUTHORITY, | ||
ADLS_DFS_STORAGE_SCHEME, | ||
ADLS_SAS_TOKEN, | ||
AWS_ACCESS_KEY_ID, | ||
AWS_REGION, | ||
AWS_ROLE_ARN, | ||
|
@@ -394,6 +401,9 @@ def _initialize_fs(self, scheme: str, netloc: Optional[str] = None) -> FileSyste | |
elif scheme in {"gs", "gcs"}: | ||
return self._initialize_gcs_fs() | ||
|
||
elif scheme in {"abfs", "abfss", "wasb", "wasbs"}: | ||
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. I cant find any pyarrow docs that indicates |
||
return self._initialize_azure_fs() | ||
|
||
elif scheme in {"file"}: | ||
return self._initialize_local_fs() | ||
|
||
|
@@ -475,6 +485,43 @@ def _initialize_s3_fs(self, netloc: Optional[str]) -> FileSystem: | |
|
||
return S3FileSystem(**client_kwargs) | ||
|
||
def _initialize_azure_fs(self) -> FileSystem: | ||
from packaging import version | ||
|
||
MIN_PYARROW_VERSION_SUPPORTING_AZURE_FS = "20.0.0" | ||
if version.parse(pyarrow.__version__) < version.parse(MIN_PYARROW_VERSION_SUPPORTING_AZURE_FS): | ||
raise ImportError( | ||
f"pyarrow version >= {MIN_PYARROW_VERSION_SUPPORTING_AZURE_FS} required for AzureFileSystem support, " | ||
f"but found version {pyarrow.__version__}." | ||
) | ||
|
||
from pyarrow.fs import AzureFileSystem | ||
|
||
client_kwargs: Dict[str, str] = {} | ||
|
||
if account_name := self.properties.get(ADLS_ACCOUNT_NAME): | ||
client_kwargs["account_name"] = account_name | ||
|
||
if account_key := self.properties.get(ADLS_ACCOUNT_KEY): | ||
client_kwargs["account_key"] = account_key | ||
|
||
if blob_storage_authority := self.properties.get(ADLS_BLOB_STORAGE_AUTHORITY): | ||
client_kwargs["blob_storage_authority"] = blob_storage_authority | ||
|
||
if dfs_storage_authority := self.properties.get(ADLS_DFS_STORAGE_AUTHORITY): | ||
client_kwargs["dfs_storage_authority"] = dfs_storage_authority | ||
|
||
if blob_storage_scheme := self.properties.get(ADLS_BLOB_STORAGE_SCHEME): | ||
client_kwargs["blob_storage_scheme"] = blob_storage_scheme | ||
|
||
if dfs_storage_scheme := self.properties.get(ADLS_DFS_STORAGE_SCHEME): | ||
client_kwargs["dfs_storage_scheme"] = dfs_storage_scheme | ||
|
||
if sas_token := self.properties.get(ADLS_SAS_TOKEN): | ||
client_kwargs["sas_token"] = sas_token | ||
|
||
return AzureFileSystem(**client_kwargs) | ||
kevinjqliu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def _initialize_hdfs_fs(self, scheme: str, netloc: Optional[str]) -> FileSystem: | ||
from pyarrow.fs import HadoopFileSystem | ||
|
||
|
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
Oops, something went wrong.
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.
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.
we should add these to the docs https://py.iceberg.apache.org/configuration/#azure-data-lake
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.
Done