Skip to content

Commit

Permalink
Ensure schema and data have the same size (#13264)
Browse files Browse the repository at this point in the history
  • Loading branch information
blaginin authored Nov 6, 2024
1 parent 6a02384 commit ca59c72
Show file tree
Hide file tree
Showing 2 changed files with 8 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 @@ -218,7 +218,7 @@ impl LogicalPlanBuilder {
if values.is_empty() {
return plan_err!("Values list cannot be empty");
}
let n_cols = values[0].len();
let n_cols = schema.fields().len();
if n_cols == 0 {
return plan_err!("Values list cannot be zero length");
}
Expand Down
7 changes: 7 additions & 0 deletions datafusion/sqllogictest/test_files/errors.slt
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,10 @@ select 1 group by substr('');
# Error in filter should be reported
query error Divide by zero
SELECT c2 from aggregate_test_100 where CASE WHEN true THEN 1 / 0 ELSE 0 END = 1;


statement error DataFusion error: Error during planning: Inconsistent data length across values list: got 4 values in row 0 but expected 2
create table records (timestamp timestamp, value float) as values (
'2021-01-01 00:00:00', 1.0,
'2021-01-01 00:00:00', 2.0
);

0 comments on commit ca59c72

Please sign in to comment.