Skip to content

Commit

Permalink
unimplemented! is a crash, unsupported! is a bail
Browse files Browse the repository at this point in the history
  • Loading branch information
quodlibetor committed Aug 18, 2021
1 parent 0754a4f commit f702c63
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sql/src/pure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ pub async fn purify_csv(
if matches!(columns, CsvColumns::Header { .. })
&& !matches!(connector, CreateSourceConnector::File { .. })
{
unimplemented!("CSV WITH HEADER with non-file sources");
unsupported!("CSV WITH HEADER with non-file sources");
}

let first_row = if let Some(file) = file {
Expand Down Expand Up @@ -558,7 +558,7 @@ pub async fn purify_csv(
if names.is_empty() {
bail!(
"CSV file expected to have at least one line \
to determine column names, but is empty"
to determine column names, but is empty"
);
} else {
None
Expand All @@ -583,6 +583,7 @@ pub async fn purify_csv(
} else {
None
};

match (&columns, first_row) {
(CsvColumns::Header { names }, Some(headers)) if names.is_empty() => {
*columns = CsvColumns::Header {
Expand All @@ -593,7 +594,7 @@ pub async fn purify_csv(
if names.len() != headers.len() {
bail!(
"Named column count ({}) does not match \
number of columns discovered ({})",
number of columns discovered ({})",
names.len(),
headers.len()
);
Expand Down

0 comments on commit f702c63

Please sign in to comment.