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

Function test_eof_behavior

parquet/src/arrow/array_reader/cached_array_reader.rs:509–534  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

507
508 #[test]
509 fn test_eof_behavior() {
510 let metrics = ArrowReaderMetrics::disabled();
511 let mock_reader = MockArrayReader::new(vec![1, 2, 3]);
512 let cache = Arc::new(RwLock::new(RowGroupCache::new(5, usize::MAX))); // Batch size 5
513 let mut cached_reader = CachedArrayReader::new(
514 Box::new(mock_reader),
515 cache,
516 0,
517 CacheRole::Consumer,
518 metrics,
519 );
520
521 // Try to read more than available
522 let read1 = cached_reader.read_records(5).unwrap();
523 assert_eq!(read1, 3); // Should only get 3 records (all available)
524
525 let array1 = cached_reader.consume_batch().unwrap();
526 assert_eq!(array1.len(), 3);
527
528 // Further reads should return 0
529 let read2 = cached_reader.read_records(1).unwrap();
530 assert_eq!(read2, 0);
531
532 let array2 = cached_reader.consume_batch().unwrap();
533 assert_eq!(array2.len(), 0);
534 }
535
536 #[test]
537 fn test_cache_sharing() {

Callers

nothing calls this directly

Calls 2

read_recordsMethod · 0.45
consume_batchMethod · 0.45

Tested by

no test coverage detected