| 704 | |
| 705 | #[tokio::test] |
| 706 | async fn test_ndjson_still_works() -> Result<()> { |
| 707 | // Ensure NDJSON format still works correctly |
| 708 | let json_data = |
| 709 | "{\"id\": 1, \"name\": \"alice\"}\n{\"id\": 2, \"name\": \"bob\"}\n"; |
| 710 | |
| 711 | let store = Arc::new(InMemory::new()); |
| 712 | let path = Path::from("test.ndjson"); |
| 713 | store |
| 714 | .put(&path, PutPayload::from_static(json_data.as_bytes())) |
| 715 | .await?; |
| 716 | |
| 717 | let opener = JsonOpener::new( |
| 718 | 1024, |
| 719 | test_schema(), |
| 720 | FileCompressionType::UNCOMPRESSED, |
| 721 | store.clone(), |
| 722 | true, // NDJSON format |
| 723 | ); |
| 724 | |
| 725 | let meta = store.head(&path).await?; |
| 726 | let file = PartitionedFile::new(path.to_string(), meta.size); |
| 727 | |
| 728 | let stream = opener.open(file)?.await?; |
| 729 | let batches: Vec<_> = stream.try_collect().await?; |
| 730 | |
| 731 | assert_eq!(batches.len(), 1); |
| 732 | assert_eq!(batches[0].num_rows(), 2); |
| 733 | |
| 734 | Ok(()) |
| 735 | } |
| 736 | |
| 737 | #[tokio::test] |
| 738 | async fn test_json_array_large_file() -> Result<()> { |