-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Incorrect Schema Adaption for CSV #4918
Comments
That memory store is quite clever |
Sorry @tustvold still not very clear, for tests above do you expect them to pass? |
It probably should error, I'm not sure that schema adaption for CSV makes all that much sense |
I think it would be valuable to support reading several CSV files from a directory as long as their schema's are compatible, even if they all did not have exactly the same schema |
Provided they have headers, this should be possible, all bets are off if any files lack headers though... That being said, this would require fairly extensive reworking on the schema adaption mechanism, as it currently does not infer per-file schemas. My vote would be to fix the silent data corruption, which is what currently happens, by returning an error if the schema aren't identical, and then potentially look into supporting more sophisticated schema management down the line if there is interest. |
I agree this sounds like the best plan to me |
Describe the bug
The schema adaption logic added in #1709 misbehaves for CSV data. In particular it incorrectly assumes that it can create a schema for the entire dataset that is a superset of those of the individual files, and that the CSV reader will pad any missing columns with nulls, and reorder those that appear in a different order.
In reality the CSV reader does not handle missing or reordered columns, it only accidentally works when the file schema happens to be an exact prefix of the aggregate schema. This was relying on an accidental quirk of the arrow reader prior to 30.0.0, after this the arrow reader returns an error as the schema does not match.
To Reproduce
Both of the following tests fail on current master
Expected behavior
I think both of the following would be valid:
Additional context
#4818 (comment)
The text was updated successfully, but these errors were encountered: