feat(sql): support ignore_corrupt_files in read_csv#7264
Open
jackylee-ch wants to merge 2 commits into
Open
Conversation
Adds the `ignore_corrupt_files` option to the SQL `read_csv` table function, closing the last gap in the ignore_corrupt_files parity matrix (Python read_csv, SQL read_parquet, and iceberg already support it). - Wire `ignore_corrupt_files` through `CsvScanBuilder` (field, setter, and `finish()` -> `CsvSourceConfig`). - Parse the named arg in the `read_csv` table provider and add it to the allowed-args list. - Release the GIL around blocking schema inference so a skipped corrupt file's `log::warn!` (forwarded by pyo3-log) cannot deadlock on GIL re-acquisition, mirroring the read_parquet fix in PR Eventual-Inc#7133. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Greptile SummaryThis PR adds corrupt-file skipping to SQL
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "feat(sql): support ignore_corrupt_files ..." | Re-trigger Greptile |
end-of-file-fixer flagged a duplicate trailing blank line. Co-Authored-By: Claude <noreply@anthropic.com>
srilman
approved these changes
Jul 21, 2026
srilman
left a comment
Contributor
There was a problem hiding this comment.
Overall LGTM @jackylee-ch, just a couple of nits around generated comments.
| )?; | ||
|
|
||
| let runtime = common_runtime::get_io_runtime(true); | ||
| // Release the GIL while blocking on async schema inference. SQL planning is reached |
Contributor
There was a problem hiding this comment.
Can we reduce or remove this comment, its unnecessarily long for a simple situation.
|
|
||
| # With ignore_corrupt_files => true the corrupt file is skipped and the good | ||
| # rows are returned. This also exercises the schema-inference glob fallback and | ||
| # the GIL release added alongside read_parquet (PR #7133). |
Contributor
There was a problem hiding this comment.
The GIL part of the comment is not relevant.
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.
Changes Made
Adds the
ignore_corrupt_filesoption to the SQLread_csvtable function. This closes the last gap in theignore_corrupt_filesparity matrix — Pythonread_csv, SQLread_parquet(#7133), and iceberg (#7130) already support it, but SQLread_csvdid not.ignore_corrupt_filesthroughCsvScanBuilder(field, setter, andfinish()→CsvSourceConfig).read_csvtable provider and add it to the allowed-args list.log::warn!(forwarded by pyo3-log) cannot deadlock on GIL re-acquisition. This mirrors theread_parquetfix in feat(sql): support read_parquet ignore_corrupt_files #7133 and the DataFrame scan path indaft-scan/src/python.rs.Usage:
Testing
tests/sql/test_sql_table_functions.py::test_sql_read_csv_ignore_corrupt_filesverifies corrupt files error by default and are skipped (withskipped_corrupt_filespopulated) when the option is set.tests/sql/andtests/io/test_ignore_corrupt_files.pysuites pass; a 40× stress loop over corrupt-file schema inference confirmed no GIL deadlock.Related Issues
Related to #7133 (SQL
read_parquetignore_corrupt_files+ GIL fix).