Skip to content

Commit 6831da1

Browse files
committed
avro: restore missing-column test behavior to pre-17861 semantics
1 parent 0019184 commit 6831da1

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

  • datafusion/core/src/datasource/physical_plan

datafusion/core/src/datasource/physical_plan/avro.rs

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,35 @@ mod tests {
172172
.execute(0, state.task_ctx())
173173
.expect("plan execution failed");
174174

175-
// Avro follows the file's writer schema for projection. Referencing a
176-
// non-existent file column should fail instead of being NULL-padded.
177-
let err = results
175+
let batch = results
178176
.next()
179177
.await
180178
.expect("plan iterator empty")
181-
.expect_err("missing projected column should error");
182-
let err_msg = err.to_string();
183-
assert!(
184-
err_msg.contains("Projection index") && err_msg.contains("out of bounds"),
185-
"unexpected error: {err_msg}"
186-
);
179+
.expect("plan iterator returned an error");
180+
181+
insta::allow_duplicates! {assert_snapshot!(batches_to_string(&[batch]), @r"
182+
+----+----------+-------------+-------------+
183+
| id | bool_col | tinyint_col | missing_col |
184+
+----+----------+-------------+-------------+
185+
| 4 | true | 0 | |
186+
| 5 | false | 1 | |
187+
| 6 | true | 0 | |
188+
| 7 | false | 1 | |
189+
| 2 | true | 0 | |
190+
| 3 | false | 1 | |
191+
| 0 | true | 0 | |
192+
| 1 | false | 1 | |
193+
+----+----------+-------------+-------------+
194+
");}
195+
196+
let batch = results.next().await;
197+
assert!(batch.is_none());
198+
199+
let batch = results.next().await;
200+
assert!(batch.is_none());
201+
202+
let batch = results.next().await;
203+
assert!(batch.is_none());
187204

188205
Ok(())
189206
}

0 commit comments

Comments
 (0)