Expect an error when reading the record batch using IPC or IPC Streams
(array: ArrayRef, expected_err: &str)
| 3376 | |
| 3377 | /// Expect an error when reading the record batch using IPC or IPC Streams |
| 3378 | fn expect_ipc_validation_error(array: ArrayRef, expected_err: &str) { |
| 3379 | let rb = RecordBatch::try_from_iter([("a", array)]).unwrap(); |
| 3380 | |
| 3381 | // IPC Stream format |
| 3382 | let buf = write_stream(&rb); // write is ok |
| 3383 | read_stream_skip_validation(&buf).unwrap(); |
| 3384 | let err = read_stream(&buf).unwrap_err(); |
| 3385 | assert_eq!(err.to_string(), expected_err); |
| 3386 | |
| 3387 | // IPC File format |
| 3388 | let buf = write_ipc(&rb); // write is ok |
| 3389 | read_ipc_skip_validation(&buf).unwrap(); |
| 3390 | let err = read_ipc(&buf).unwrap_err(); |
| 3391 | assert_eq!(err.to_string(), expected_err); |
| 3392 | |
| 3393 | // IPC Format with FileDecoder |
| 3394 | read_ipc_with_decoder_skip_validation(buf.clone()).unwrap(); |
| 3395 | let err = read_ipc_with_decoder(buf).unwrap_err(); |
| 3396 | assert_eq!(err.to_string(), expected_err); |
| 3397 | } |
| 3398 | |
| 3399 | #[test] |
| 3400 | fn test_roundtrip_schema() { |