Skip to content
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d406591
Support WebHDFS: C++ implementation
kingcrimsontianyu Aug 5, 2025
2e8328f
Update
kingcrimsontianyu Aug 5, 2025
46c1cbb
Move advanced URL handling to a separate PR to reduce the scope of cu…
kingcrimsontianyu Aug 5, 2025
8fd6a70
Update
kingcrimsontianyu Aug 5, 2025
cecd49c
Add clarifying comments
kingcrimsontianyu Aug 5, 2025
e6e4d56
Add more comments
kingcrimsontianyu Aug 5, 2025
97da554
Update
kingcrimsontianyu Aug 5, 2025
6b48777
Update
kingcrimsontianyu Aug 5, 2025
e4fbd35
Add default arg
kingcrimsontianyu Aug 5, 2025
3792549
Add Python binding for WebHDFS
kingcrimsontianyu Aug 5, 2025
87603f0
Fix a bug where too large file causes string-to-size conversion to fail
kingcrimsontianyu Aug 5, 2025
95e1c91
Merge branch 'web-hdfs' into python-web-hdfs
kingcrimsontianyu Aug 5, 2025
c3881e0
Merge branch 'branch-25.10' into web-hdfs
kingcrimsontianyu Aug 5, 2025
c91fcfb
Merge branch 'web-hdfs' into python-web-hdfs
kingcrimsontianyu Aug 5, 2025
bb256f2
For WebHDFS unit test, fix segfault when the test is skipped; create/…
kingcrimsontianyu Aug 7, 2025
969f6d0
Remove unnecessary ntvx annotation
kingcrimsontianyu Aug 7, 2025
377d88e
Update cpp/tests/CMakeLists.txt
kingcrimsontianyu Aug 7, 2025
9c6477c
Attempt to fix CI overlinking error
kingcrimsontianyu Aug 7, 2025
fee32db
Merge branch 'web-hdfs' into python-web-hdfs
kingcrimsontianyu Aug 7, 2025
0507d78
Remove libcurl from libkvikio-tests' run section
kingcrimsontianyu Aug 7, 2025
ec0871e
Merge branch 'web-hdfs' into python-web-hdfs
kingcrimsontianyu Aug 7, 2025
7936f64
Merge branch 'branch-25.10' into python-web-hdfs
kingcrimsontianyu Aug 8, 2025
9d70828
Reformat
kingcrimsontianyu Aug 8, 2025
799db68
Add pytest-httpserver dependency for webhdfs testing
kingcrimsontianyu Aug 12, 2025
2a67c55
Investigate http server hang. DO NOT MERGE
kingcrimsontianyu Aug 12, 2025
d2e958f
Revert some changes
kingcrimsontianyu Aug 13, 2025
e53aee4
Merge branch 'branch-25.10' into python-web-hdfs
kingcrimsontianyu Aug 13, 2025
ddf21e6
Revert some auto-reformatting changes to pyproject.toml
kingcrimsontianyu Aug 13, 2025
d4bfaea
Add unit test for 'get file size'
kingcrimsontianyu Aug 13, 2025
258bf63
Update
kingcrimsontianyu Aug 14, 2025
8d683b2
Improve test organization
kingcrimsontianyu Aug 14, 2025
27a8467
Cleanup
kingcrimsontianyu Aug 14, 2025
cc4f75a
Add partial read test
kingcrimsontianyu Aug 14, 2025
f74a230
Remove the debug script
kingcrimsontianyu Aug 14, 2025
05e31f8
Add missing type hint wherever possible
kingcrimsontianyu Aug 14, 2025
d2ca076
Attempt to fix the MultiDict issue
kingcrimsontianyu Aug 14, 2025
8f43cbc
Fix a critical bug in unit test
kingcrimsontianyu Aug 14, 2025
1d7db15
Modify unit test. Create barebone HTTP server, and run it in a backgr…
kingcrimsontianyu Aug 14, 2025
7c9a1ff
Adjust implementation
kingcrimsontianyu Aug 14, 2025
82512bd
Fix CI error on Queue[int] type hint
kingcrimsontianyu Aug 14, 2025
fe87dcb
Remove pytest-httpserver dependency
kingcrimsontianyu Aug 15, 2025
326c482
Address review comments
kingcrimsontianyu Aug 15, 2025
51be21c
Expand HDFS unit test to cupy
kingcrimsontianyu Aug 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions python/kvikio/kvikio/_lib/remote_handle.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ cdef extern from "<kvikio/remote_handle.hpp>" nogil:
size_t file_offset
) except +

cdef extern from "<kvikio/hdfs.hpp>" nogil:
cdef cppclass cpp_WebHdfsEndpoint "kvikio::WebHdfsEndpoint"(cpp_RemoteEndpoint):
cpp_WebHdfsEndpoint(string url) except +

cdef string _to_string(str s):
"""Convert Python object to a C++ string (if None, return the empty string)"""
Expand Down Expand Up @@ -157,6 +160,18 @@ cdef class RemoteFile:
nbytes
)

@staticmethod
def open_webhdfs(
url: str,
nbytes: Optional[int],
):
return RemoteFile._from_endpoint(
cast_to_remote_endpoint(
make_unique[cpp_WebHdfsEndpoint](_to_string(url))
),
nbytes
)

def __str__(self) -> str:
cdef string ep_str = deref(self._handle).endpoint().str()
return f'<{self.__class__.__name__} "{ep_str.decode()}">'
Expand Down
21 changes: 21 additions & 0 deletions python/kvikio/kvikio/remote_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,27 @@ def open_s3_presigned_url(
)
)

@classmethod
def open_webhdfs(
cls,
url: str,
nbytes: Optional[int] = None,
) -> RemoteFile:
"""Open a file on Apache Hadoop Distributed File System (HDFS) using WebHDFS.

If KvikIO is run within a Docker, the argument ``--network host`` needs to be
passed to the ``docker run`` command.

Parameters
----------
url
URL to the remote file.
nbytes
The size of the file. If None, KvikIO will ask the server for the file
size.
"""
return RemoteFile(_get_remote_module().RemoteFile.open_webhdfs(url, nbytes))

def close(self) -> None:
"""Close the file"""
pass
Expand Down