MCPcopy Create free account
hub / github.com/apache/datafusion / test_empty_range

Function test_empty_range

datafusion/datasource-json/src/boundary_stream.rs:549–603  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

547
548 #[tokio::test]
549 async fn test_empty_range() {
550 // start >= end — no complete line can exist, regardless of data.
551 static DATA: &[u8] = b"line1\nline2\n";
552 for &cs in CHUNK_SIZES {
553 let (store, path) = make_chunked_store(DATA, cs).await;
554
555 // start > end (non-zero start)
556 let s = AlignedBoundaryStream::new(
557 Arc::clone(&store),
558 path.clone(),
559 10,
560 5,
561 20,
562 b'\n',
563 )
564 .await
565 .unwrap();
566 assert!(
567 collect_stream(s).await.is_empty(),
568 "start>end chunk_size={cs}"
569 );
570
571 // start == end == 0 (zero start, previously unguarded)
572 let s = AlignedBoundaryStream::new(
573 Arc::clone(&store),
574 path.clone(),
575 0,
576 0,
577 12,
578 b'\n',
579 )
580 .await
581 .unwrap();
582 assert!(
583 collect_stream(s).await.is_empty(),
584 "start==end==0 chunk_size={cs}"
585 );
586
587 // start == end (non-zero)
588 let s = AlignedBoundaryStream::new(
589 Arc::clone(&store),
590 path.clone(),
591 6,
592 6,
593 12,
594 b'\n',
595 )
596 .await
597 .unwrap();
598 assert!(
599 collect_stream(s).await.is_empty(),
600 "start==end==6 chunk_size={cs}"
601 );
602 }
603 }
604
605 #[tokio::test]
606 async fn test_start_align_across_chunks() {

Callers

nothing calls this directly

Calls 3

make_chunked_storeFunction · 0.85
newFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…