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

Function _test_round_trip_import

arrow-array/src/ffi_stream.rs:473–493  ·  view source on GitHub ↗
(batch: RecordBatch, schema: Arc<Schema>)

Source from the content-addressed store, hash-verified

471 }
472
473 fn _test_round_trip_import(batch: RecordBatch, schema: Arc<Schema>) -> Result<()> {
474 let iter = Box::new(vec![batch.clone(), batch.clone()].into_iter().map(Ok)) as _;
475
476 let reader = TestRecordBatchReader::new(schema.clone(), iter);
477
478 // Import through `FFI_ArrowArrayStream` as `ArrowArrayStreamReader`
479 let stream = FFI_ArrowArrayStream::new(reader);
480 let stream_reader = ArrowArrayStreamReader::try_new(stream).unwrap();
481
482 let imported_schema = stream_reader.schema();
483 assert_eq!(imported_schema, schema);
484
485 let mut produced_batches = vec![];
486 for batch in stream_reader {
487 produced_batches.push(batch.unwrap());
488 }
489
490 assert_eq!(produced_batches, vec![batch.clone(), batch]);
491
492 Ok(())
493 }
494
495 #[test]
496 fn test_stream_round_trip() {

Callers 2

test_stream_round_tripFunction · 0.85

Calls 5

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

Tested by 2

test_stream_round_tripFunction · 0.68