-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add pyarrow usage test case #38
Merged
Merged
Changes from all commits
Commits
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 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 |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
"pytest", | ||
"pytest-aiohttp", | ||
"ray", | ||
"pyarrow", | ||
] | ||
}, | ||
python_requires=">=3.8", | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import logging | ||
import os | ||
|
||
from pyarrow.fs import FSSpecHandler | ||
from pyarrow.fs import PyFileSystem | ||
|
||
from alluxiofs import AlluxioFileSystem | ||
from tests.conftest import ALLUXIO_FILE_PATH | ||
from tests.conftest import LOCAL_FILE_PATH | ||
from tests.fs.test_docker_fsspec_cat import ALLUXIO_PREFIX | ||
from tests.fs.test_docker_fsspec_cat import FILE_PATH | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
def alluxio_pyarrow_test(py_fs, alluxio_path, local_path): | ||
file_size = os.path.getsize(local_path) | ||
|
||
file_info = py_fs.get_file_info(alluxio_path) | ||
assert file_info.is_file | ||
assert file_info.size == file_size | ||
assert file_info.path == alluxio_path | ||
|
||
with py_fs.open_input_file(alluxio_path) as f: | ||
alluxio_file_data = f.read() | ||
|
||
with open(local_path, "rb") as local_file: | ||
local_file_data = local_file.read() | ||
assert local_file_data == alluxio_file_data | ||
|
||
|
||
def test_alluxio_pyarrow(alluxio_file_system: AlluxioFileSystem): | ||
py_fs = PyFileSystem(FSSpecHandler(alluxio_file_system)) | ||
|
||
alluxio_pyarrow_test(py_fs, ALLUXIO_FILE_PATH, LOCAL_FILE_PATH) | ||
alluxio_pyarrow_test( | ||
py_fs, | ||
ALLUXIO_PREFIX + ALLUXIO_FILE_PATH, | ||
LOCAL_FILE_PATH, | ||
) | ||
alluxio_pyarrow_test(py_fs, FILE_PATH, LOCAL_FILE_PATH) | ||
|
||
|
||
def test_etcd_alluxio_pyarrow( | ||
etcd_alluxio_file_system: AlluxioFileSystem, | ||
): | ||
test_alluxio_pyarrow(etcd_alluxio_file_system) |
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.
Can you add the the PyArrow usage examples in the README.md
especially how can we create the PyFileSystem using other ways, we may not be able to pass in created alluxio_file_system to PyArrow Filesystem but directly pass the arguments to create PyFileSystem directly
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.
Sure, I will add it in the next PR.