Skip to content

[HfFileSystem] Fix end-of-file read() #3080

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
merged 4 commits into from
May 15, 2025
Merged

[HfFileSystem] Fix end-of-file read() #3080

merged 4 commits into from
May 15, 2025

Conversation

lhoestq
Copy link
Member

@lhoestq lhoestq commented May 13, 2025

When a file is read completely, calling read()again should return an empty output.

This was causing issues when using pyiceberg to read files on HF

@lhoestq lhoestq requested a review from Wauplin May 13, 2025 16:09
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix looks good but can you add a simple test for it please?

@lhoestq
Copy link
Member Author

lhoestq commented May 14, 2025

done !

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Wauplin
Copy link
Contributor

Wauplin commented May 15, 2025

@lhoestq test is failing in CI 😕

FAILED ../tests/test_hf_file_system.py::HfFileSystemTests::test_stream_file - AssertionError: b'dummy binary data' != b''
= 1 failed, 1031 passed, 85 skipped, 11 warnings, 8 rerun in 261.55s (0:04:21) =

@lhoestq
Copy link
Member Author

lhoestq commented May 15, 2025

Nice, I spotted the same bug in the streaming case this way ^^ it's fixed now !

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks for fixing :) CI's green so let's merge

@Wauplin Wauplin merged commit a735c1a into main May 15, 2025
25 checks passed
@Wauplin Wauplin deleted the fix-hffs-eof-read branch May 15, 2025 14:12
hanouticelina pushed a commit that referenced this pull request May 19, 2025
* fix hffs oef read

* add test

* fix test

---------

Co-authored-by: Lucain <lucain@huggingface.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants