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

Function test_json_array_empty

datafusion/datasource-json/src/source.rs:641–669  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

639
640 #[tokio::test]
641 async fn test_json_array_empty() -> Result<()> {
642 // Test empty JSON array
643 let json_data = "[]";
644
645 let store = Arc::new(InMemory::new());
646 let path = Path::from("empty.json");
647 store
648 .put(&path, PutPayload::from_static(json_data.as_bytes()))
649 .await?;
650
651 let opener = JsonOpener::new(
652 1024,
653 test_schema(),
654 FileCompressionType::UNCOMPRESSED,
655 store.clone(),
656 false,
657 );
658
659 let meta = store.head(&path).await?;
660 let file = PartitionedFile::new(path.to_string(), meta.size);
661
662 let stream = opener.open(file)?.await?;
663 let batches: Vec<_> = stream.try_collect().await?;
664
665 let total_rows: usize = batches.iter().map(|b| b.num_rows()).sum();
666 assert_eq!(total_rows, 0);
667
668 Ok(())
669 }
670
671 #[tokio::test]
672 async fn test_json_array_range_not_supported() {

Callers

nothing calls this directly

Calls 9

newFunction · 0.85
sumMethod · 0.80
test_schemaFunction · 0.70
putMethod · 0.45
cloneMethod · 0.45
to_stringMethod · 0.45
openMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…