You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invalid CSV null_regex panics the query task instead of returning an error #25260
A malformed null_regex panics the query task instead of returning an error. CsvFormat::infer_schema_from_stream compiles the pattern with
// datafusion/datasource-csv/src/file_format.rslet regex = Regex::new(null_regex.as_str()).expect("Unable to parse CSV null regex.");
so any pattern the regex crate rejects aborts the task rather than surfacing
as a DataFusionError. It is reachable straight from SQL, from a CREATE EXTERNAL TABLE that does not spell out its columns, since that is what makes
schema inference run.
task 9 panicked with message "Unable to parse CSV null regex.: Syntax(
regex parse error:
(
^
error: unclosed group
)"
Reproduced on main (9082d6b) through the sqllogictest harness. Any invalid
pattern does it; ( is just the shortest.
Expected behavior
An invalid null_regex is a bad option value, so it should come back as an
error naming the offending pattern — the same way other malformed CSV options
are handled — and leave the session usable.
Additional context
Noticed while working on #25213 / #25254. That PR changes CsvSource::builder
to return Result for the same reason on the read side, so it does not add a
second panic; this one is on the inference side and is independent of it.
The regex is also recompiled for every chunk inside the inference loop, so
hoisting the compile out is both the fix and a small saving.
Activity
fix: return an error for an invalid CSV null_regex instead of panicki…
fix: return an error for an invalid CSV null_regex instead of panicki…