GH-35806: [R] Improve error message for null type inference with sparse CSV data#49338
Draft
thisisnic wants to merge 1 commit intoapache:mainfrom
Draft
GH-35806: [R] Improve error message for null type inference with sparse CSV data#49338thisisnic wants to merge 1 commit intoapache:mainfrom
thisisnic wants to merge 1 commit intoapache:mainfrom
Conversation
…h sparse CSV data When a CSV column contains only missing values in the first block of data, Arrow infers the type as null. If a non-null value appears later, the conversion fails with an unhelpful error suggesting `skip = 1`. This change adds a specific check for "conversion error to null" and provides a more helpful message explaining the cause (type inference from sparse data) and the solution (specify column types explicitly). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
|
Member
Author
|
I'm not totally happy with the error message, will rewrite before marking ready for review |
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.
Rationale for this change
When reading a CSV with sparse data (many missing values followed by actual values), Arrow can infer a column type as
nullbased on the first block of data. When non-null values appear later, the error message incorrectly suggests usingskip = 1for header rows, which is misleading.What changes are included in this PR?
Adds a specific check for "conversion error to null" that provides a helpful message explaining the cause (type inference from sparse data) and the solution (specify column types explicitly via
col_typesorschema).Are these changes tested?
Yes, added a test in
test-dataset-csv.R.Are there any user-facing changes?
Yes, improved error message when CSV type inference fails due to sparse data.
This PR was authored by Claude (Opus 4.5) and reviewed by @thisisnic.
🤖 Generated with Claude Code