databendlabs/databend · warning
expected tsv params
Error message
expected tsv params
What it means
In a unit test helper get_text_params, options are parsed into FileFormatParams and then narrowed to TextFileFormatParams; any non-Text result triggers unreachable!("expected tsv params"). It signals the test built options that do not produce the Text (TSV) variant it expects.
Solutions
- Inspect the failing options map and ensure the format/TYPE option resolves to Text (TSV).
- Update the helper to panic with the actual parsed variant so failures are diagnosable.
- Fix the option-parsing regression if these options should legitimately parse to Text.
Example fix
// before
match params {
FileFormatParams::Text(v) => v,
_ => unreachable!("expected tsv params"),
}
// after
match params {
FileFormatParams::Text(v) => v,
other => panic!("expected tsv params, got {:?}", other),
} Defensive patterns
Strategy: validation
Validate before calling
let parsed = FileFormatParams::try_from_reader(FileFormatOptionsReader::from_map(options.clone()), false)
.expect("options should parse");
assert!(matches!(parsed, FileFormatParams::Text(_)), "options must yield Text params: {:?}", parsed); Prevention
- Keep TSV test options minimal and explicit about the format type.
- Panic with the actual parsed variant (not bare unreachable!) for diagnosability.
- Re-check test helpers after any file-format option-parsing change.
- Copy options only between tests of the same format.
When it happens
Trigger: Passing a BTreeMap of options to get_text_params whose parsed FileFormatParams is not FileFormatParams::Text — e.g. a TYPE/format key set to CSV or missing entirely, or new option parsing that maps these options to a different variant.
Common situations: Adding or changing file-format option parsing so TSV options now resolve to another variant; copy-pasting options from a CSV test into the TSV helper; a rename of the format identifier for text formats.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/decc96d612ec4165.
Report an issue: GitHub.
Appendix: source
Thrown at src/meta/app/src/principal/file_format.rs:1299
ErrorCode::InvalidArgument(format!(
"Invalid option value: NULL_IF is currently set to {s} (in JSON). The valid values are a list of strings."
)))?;
Ok(values)
}
}
}
#[cfg(test)]
mod tests {
use super::*;
fn get_text_params(options: BTreeMap<String, String>) -> TextFileFormatParams {
let params =
FileFormatParams::try_from_reader(FileFormatOptionsReader::from_map(options), false)
.expect("tsv file format options should parse");
match params {
FileFormatParams::Text(v) => v,
_ => unreachable!("expected tsv params"),
}
}
fn get_csv_params(options: BTreeMap<String, String>) -> CsvFileFormatParams {
let params =
FileFormatParams::try_from_reader(FileFormatOptionsReader::from_map(options), false)
.expect("csv file format options should parse");
match params {
FileFormatParams::Csv(v) => v,
_ => unreachable!("expected csv params"),
}
}
#[test]
fn test_text_field_delimiter_empty_string() {
let mut options = BTreeMap::new();
options.insert("type".to_string(), "TEXT".to_string());
options.insert("field_delimiter".to_string(), "".to_string());View on GitHub (pinned to 288d84d76e)