Should CSV/JSONL scan fail loudly on rows that don't match the inferred schema? #6324
eugenegujing
started this conversation in
General
Replies: 1 comment
-
|
The changes you are trying to make is related to this issue: #1181. Maybe @Yicong-Huang might have a context? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The problem
Texera's CSV/JSONL scan source operators infer each column's type from only a sample of the first ~100 rows (
INFER_READ_LIMIT). At read time, if a later row holds a value that doesn't parse as the inferred type, the operator currently silently drops the entire row — no error, no warning, no skipped-row count, nothing in the console. Every downstream count, aggregate, join, or model then runs on a silently truncated dataset, and the user has no way to know data was lost.Concrete example: a CSV whose
agecolumn is integer for the first 100 rows (inferredINTEGER) but holds55.5at row 150. Row 150 is dropped, so a 403-row file scans as 402 rows — silently. There's also an inconsistency: an empty cell is kept asnull(the row survives), but a cell that fails to parse takes the whole row down. The more destructive path is the quiet one.Issue: #6279 — Proposed fix (PR): #6323
Why I'm raising it here
This is a behavior change, so I'd like committer/community input before it lands. The proposed fix converts the silent drop into a loud, actionable failure:
Example of the new message:
The trade-off: workflows that currently run to completion on slightly-dirty data will start failing on the first bad row. That's the intended improvement (loud > silent), but it will be visible to existing users, so I'd rather get consensus than surprise anyone.
What I found looking at other platforms
Before settling on "fail loudly", I did a small investigation into how comparable data systems handle the same situation (a sampled/inferred column type vs. a later value that doesn't match). The short version: not one of them silently drops whole rows — Texera's current behavior is the outlier. So I modeled the proposed fix on the common default across these systems.
FAILFAST), Polars, DuckDBCOPY ... ON_ERROR ignoreignore_errors+ rejects tableSo the options on the table, all with real precedent:
FAILFAST, Polars, DuckDBThe inference sampling itself (first 100 rows) is not the bug and isn't changed here; the bug is that a mismatch at read time is handled silently.
Questions / where I'd love feedback
infer_schema_length=None/ DuckDBsample_size=-1) — so users who knowingly have heterogeneous data can still proceed?Very welcome to discuss — all suggestions and alternative directions are appreciated, and I'm happy to revise the PR (#6323) based on whatever consensus we reach here. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions