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

Function test_real_world_format_large

datafusion/datasource-json/src/utils.rs:705–732  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

703 /// Test with real-world-like data format (with leading whitespace and newlines)
704 #[test]
705 fn test_real_world_format_large() {
706 let large_value = "x".repeat(8000);
707
708 // Format similar to real files: opening bracket on its own line,
709 // each object indented with 2 spaces
710 let mut objects = vec![];
711 for i in 0..10 {
712 objects.push(format!(r#" {{"id":{i},"data":"{large_value}"}}"#));
713 }
714
715 let input = format!("[\n{}\n]", objects.join(",\n"));
716
717 let mut reader = JsonArrayToNdjsonReader::with_capacity(input.as_bytes(), 8192);
718 let mut output = String::new();
719 reader.read_to_string(&mut output).unwrap();
720
721 let lines: Vec<&str> = output.lines().collect();
722 assert_eq!(lines.len(), 10, "Expected 10 objects");
723
724 for (i, line) in lines.iter().enumerate() {
725 assert!(
726 line.starts_with("{\"id\""),
727 "Line {} should start with object, got: {}...",
728 i,
729 &line[..50.min(line.len())]
730 );
731 }
732 }
733
734 /// Test ChannelReader
735 #[test]

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
collectMethod · 0.80
pushMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…