MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_error_import

Function test_error_import

arrow-array/src/ffi_stream.rs:533–557  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

531
532 #[test]
533 fn test_error_import() -> Result<()> {
534 let schema = Arc::new(Schema::new(vec![Field::new("a", DataType::Int32, true)]));
535
536 let iter = Box::new(vec![Err(ArrowError::MemoryError("".to_string()))].into_iter());
537
538 let reader = TestRecordBatchReader::new(schema.clone(), iter);
539
540 // Import through `FFI_ArrowArrayStream` as `ArrowArrayStreamReader`
541 let stream = FFI_ArrowArrayStream::new(reader);
542 let stream_reader = ArrowArrayStreamReader::try_new(stream).unwrap();
543
544 let imported_schema = stream_reader.schema();
545 assert_eq!(imported_schema, schema);
546
547 let mut produced_batches = vec![];
548 for batch in stream_reader {
549 produced_batches.push(batch);
550 }
551
552 // The results should outlive the lifetime of the stream itself.
553 assert_eq!(produced_batches.len(), 1);
554 assert!(produced_batches[0].is_err());
555
556 Ok(())
557 }
558}

Callers

nothing calls this directly

Calls 5

try_newFunction · 0.85
into_iterMethod · 0.45
cloneMethod · 0.45
schemaMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected