Skip to content

Commit

Permalink
Minor: improve error message by adding types to message (#8065)
Browse files Browse the repository at this point in the history
* Minor: improve error message

* add test
  • Loading branch information
alamb authored Nov 6, 2023
1 parent e95e3f8 commit af3ce6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion datafusion/expr/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl LogicalPlanBuilder {
let data_type = expr.get_type(&empty_schema)?;
if let Some(prev_data_type) = &field_types[j] {
if prev_data_type != &data_type {
return plan_err!("Inconsistent data type across values list at row {i} column {j}");
return plan_err!("Inconsistent data type across values list at row {i} column {j}. Was {prev_data_type} but found {data_type}")
}
}
Ok(Some(data_type))
Expand Down
4 changes: 4 additions & 0 deletions datafusion/sqllogictest/test_files/errors.slt
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,7 @@ c9,
nth_value(c5, 2, 3) over (order by c9) as nv1
from aggregate_test_100
order by c9


statement error Inconsistent data type across values list at row 1 column 0. Was Int64 but found Utf8
create table foo as values (1), ('foo');

0 comments on commit af3ce6b

Please sign in to comment.