feat: Add Apache Gravitino virtual file system (gvfs://) read support in io module - #5766
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5766 +/- ##
========================================
Coverage 72.48% 72.48%
========================================
Files 966 968 +2
Lines 125838 126093 +255
========================================
+ Hits 91211 91402 +191
- Misses 34627 34691 +64
🚀 New features to boost your workflow:
|
312db4f to
0dea595
Compare
Greptile OverviewGreptile SummaryThis PR implements Apache Gravitino virtual filesystem ( Key Changes:
Architecture: Testing: Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant Daft
participant Filesystem as filesystem.py
participant GravFS as GravitinoFileSystem
participant RustIO as Rust IO Layer
participant GravSource as GravitinoSource
participant GravAPI as Gravitino API
participant S3
User->>Daft: read_parquet("gvfs://fileset/cat/schema/fs/file.parquet")
Daft->>Filesystem: _resolve_paths_and_filesystem()
Filesystem->>Filesystem: get_protocol_from_path() → "gvfs"
Filesystem->>Filesystem: _infer_filesystem()
Filesystem->>GravFS: GravitinoFileSystem(io_config)
GravFS-->>Filesystem: PyArrow FS wrapper
Filesystem-->>Daft: filesystem + path
Daft->>RustIO: io_glob() with gvfs:// path
RustIO->>GravSource: get_or_create_io_client("cat.schema.fs")
alt First access (not cached)
GravSource->>GravAPI: load_fileset("cat.schema.fs")
GravAPI-->>GravSource: fileset metadata + storage_location (s3://...)
GravSource->>GravSource: Create IOClient with S3 credentials
GravSource->>GravSource: Cache client for "cat.schema.fs"
else Already cached
GravSource->>GravSource: Return cached client
end
GravSource->>GravSource: fileset_path_to_source_and_url()
GravSource->>GravSource: Parse gvfs:// → extract cat/schema/fs/path
GravSource->>GravSource: Build S3 path: storage_location + path
GravSource->>S3: get() via IOClient
S3-->>GravSource: file data
GravSource-->>RustIO: file data
RustIO-->>Daft: DataFrame
Daft-->>User: DataFrame
|
There was a problem hiding this comment.
Additional Comments (2)
-
daft/io/gravitino_filesystem.py, line 121-137 (link)style:
__getattr__returns dummy functions for missing attributes, which can mask legitimateAttributeErrors. Consider explicitly implementing only the methods PyArrow needs (likefileno,isatty,mode,name) instead of this catch-all approach. -
daft/io/gravitino_filesystem.py, line 121-137 (link)style:
__getattr__creates redundant logic since explicit methods forfileno,isatty,mode, andnameare already defined below (lines 210-220). The__getattr__method will never be called for these attributes. Consider removing this method entirely or only handling truly dynamic attributes.
25 files reviewed, 2 comments
3061c03 to
7186b2b
Compare
kevinzwang
left a comment
There was a problem hiding this comment.
Aside from the comment about the GravatinoFileSystem, I am happy to merge these changes in. I am not so familiar with the nuances of gravatino catalogs, tables, and filesets but the changes seem fairly straightforward and isolated so I will trust that you have the logic implemented correctly. Thanks for the contribution!
There was a problem hiding this comment.
I'm not sure if GravatinoFileSystem is needed at all since we do not go through the PyArrow filesystem path for anything except certain write operations, and it looks like this PR only supports reads.
There was a problem hiding this comment.
Hi Kevin, you're righ, the GravatinoFileSystem was built to support gvfs:// writes. Previously I have implement both read and write function, and per your suggestion I split them into multiple PRs, this class was kept here. I think it can be removed now and added back in subsequent PR.
There was a problem hiding this comment.
I removed it from this pr; see the commit: eb35001
There was a problem hiding this comment.
also removed other unrelated codes, please review.
There was a problem hiding this comment.
I'm curious if writes can be implemented on the Rust side as well. That would be nice just so that it's in the same place. But for this PR, thanks for cleaning it up, will take another look!
|
Thanks for the contribution! Re-running the failed tests and enabling auto-merge. |
This issue is still there: #5776 |
|
@shaofengshi could you check if the gravatino Docker services are conflicting somehow with the Iceberg ones for the catalogs integration test? I'm not seeing the same errors on the main branch. |
Head branch was pushed to by a user without write access
Thanks Kevin for the suggestion! There was a port conflict but as the integration test is executed in sequence (and iceberg is ahead of gravitino), so I'm not sure that is the root cause. Besides, just 1 iceberg test case failed (tests/integration/iceberg/test_iceberg_reads.py::TestIcebergCountPushdown::test_count_pushdown_with_delete_files[test_overlapping_deletes]), others are success, so I assume it is not environment issue. Anyway I resolved the port conflict and other potential confliction in the docker service. Let's see how CI builds this time. If the iceberg test failure couldn't be reproduced in your side, that might be my problem. I will dive into the details. |
|
Kevin, I have confirmed the iceberg integration test failure has no relationship with my PR. Xiaoxiaohu has reproduced that with main branch, and she is going to fix that with this PR: #5864 So, my PR is safe to merge. :) |
e3af814 to
7404453
Compare
|
@shaofengshi I figured it out. It's because both the Iceberg and Gravitino Docker composes had a service named |
|
@shaofengshi looks like there's some style checks failing. Once you clean those up I'm happy to merge this in! Note: you can run those checks locally by installing the pre-commit hooks via |
This reverts commit 7404453.
Head branch was pushed to by a user without write access
af427b7 to
ed449a5
Compare
Kevin, I have fixed the style issue. Please check now. @kevinzwang |
|
Looks great, thanks again for the contribution @shaofengshi! Merging it in. A great next step would be to add information about the Gravitino integration to our docs as well! |
Thank you Kevin! Sure, I will update the document in subsequent PR. |
Changes Made
Add Gravitino virtual file system (gvfs://) support read support. So that user can use "gvfs://filesets/catalog/schema/fileset_name" path to access s3 (and other cloud storages) location.
This PR only implements the s3 as the first step. To ensure the functionality, the integration test cases are added with a MinIO service to simulate s3.
Related Issues
This is the second pr for #5503