()
| 569 | |
| 570 | #[tokio::test] |
| 571 | async fn test_json_array_from_stream() -> Result<()> { |
| 572 | // Test reading JSON array format from object store stream (simulates S3) |
| 573 | let json_data = r#"[{"id": 1, "name": "alice"}, {"id": 2, "name": "bob"}, {"id": 3, "name": "charlie"}]"#; |
| 574 | |
| 575 | // Use InMemory store which returns Stream payload |
| 576 | let store = Arc::new(InMemory::new()); |
| 577 | let path = Path::from("test_stream.json"); |
| 578 | store |
| 579 | .put(&path, PutPayload::from_static(json_data.as_bytes())) |
| 580 | .await?; |
| 581 | |
| 582 | let opener = JsonOpener::new( |
| 583 | 2, // small batch size to test multiple batches |
| 584 | test_schema(), |
| 585 | FileCompressionType::UNCOMPRESSED, |
| 586 | store.clone(), |
| 587 | false, // JSON array format |
| 588 | ); |
| 589 | |
| 590 | let meta = store.head(&path).await?; |
| 591 | let file = PartitionedFile::new(path.to_string(), meta.size); |
| 592 | |
| 593 | let stream = opener.open(file)?.await?; |
| 594 | let batches: Vec<_> = stream.try_collect().await?; |
| 595 | |
| 596 | let total_rows: usize = batches.iter().map(|b| b.num_rows()).sum(); |
| 597 | assert_eq!(total_rows, 3); |
| 598 | |
| 599 | Ok(()) |
| 600 | } |
| 601 | |
| 602 | #[tokio::test] |
| 603 | async fn test_json_array_nested_objects() -> Result<()> { |
nothing calls this directly
no test coverage detected
searching dependent graphs…