()
| 736 | |
| 737 | #[tokio::test] |
| 738 | async fn test_json_array_large_file() -> Result<()> { |
| 739 | // Test with a larger JSON array to verify streaming works |
| 740 | let mut json_data = String::from("["); |
| 741 | for i in 0..1000 { |
| 742 | if i > 0 { |
| 743 | json_data.push(','); |
| 744 | } |
| 745 | json_data.push_str(&format!(r#"{{"id": {i}, "name": "user{i}"}}"#)); |
| 746 | } |
| 747 | json_data.push(']'); |
| 748 | |
| 749 | let store = Arc::new(InMemory::new()); |
| 750 | let path = Path::from("large.json"); |
| 751 | store |
| 752 | .put(&path, PutPayload::from(Bytes::from(json_data))) |
| 753 | .await?; |
| 754 | |
| 755 | let opener = JsonOpener::new( |
| 756 | 100, // batch size of 100 |
| 757 | test_schema(), |
| 758 | FileCompressionType::UNCOMPRESSED, |
| 759 | store.clone(), |
| 760 | false, |
| 761 | ); |
| 762 | |
| 763 | let meta = store.head(&path).await?; |
| 764 | let file = PartitionedFile::new(path.to_string(), meta.size); |
| 765 | |
| 766 | let stream = opener.open(file)?.await?; |
| 767 | let batches: Vec<_> = stream.try_collect().await?; |
| 768 | |
| 769 | let total_rows: usize = batches.iter().map(|b| b.num_rows()).sum(); |
| 770 | assert_eq!(total_rows, 1000); |
| 771 | |
| 772 | // Should have multiple batches due to batch_size=100 |
| 773 | assert!(batches.len() >= 10); |
| 774 | |
| 775 | Ok(()) |
| 776 | } |
| 777 | |
| 778 | #[tokio::test] |
| 779 | async fn test_json_array_stream_cancellation() -> Result<()> { |
nothing calls this directly
no test coverage detected
searching dependent graphs…