Repository navigation
Ignore backup extensions when discovering data files - #9110
Open
codingfeng-fufu wants to merge 1 commit into
Open
codingfeng-fufu wants to merge 1 commit into
codingfeng-fufu wants to merge 1 commit into
Conversation
Assisted-by: OpenAI Codex
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this fixes
Fixes #9100. When Datasets discovers files in a directory,
previous.csv.bakcan be selected as a CSV file because the extension filter matches every dot-separated component. If the backup still contains valid CSV, its stale rows can be included without an error.Check the final filename extension. If it is a recognized single-file compression extension, also check the preceding data extension. This keeps formats such as
.csv.gzand.parquet.xzdiscoverable.Validation
39fd698dand passed with the patch.tests/test_data_files.pywith the patched main module and installed Datasets 4.4.1 dependencies. Result was170 passed, 1 skipped, 56 deselected in 0.66s. The skipped test requires symlinks on Windows. The selection excludes Hub and external fixtures.load_dataset(directory)with an ordinary CSV, a gzipped CSV, and a CSV backup. The original resolver loaded[1, 2, 999]. Substituting the patched resolver loaded[1, 2], including the gzip record.OpenAI Codex assisted with investigation, implementation, and local validation.