()
| 875 | |
| 876 | #[tokio::test] |
| 877 | async fn test_ndjson_partitioned() -> Result<()> { |
| 878 | // Build an NDJSON file with a known number of rows. |
| 879 | let num_rows: usize = 20; |
| 880 | let mut ndjson = String::new(); |
| 881 | for i in 0..num_rows { |
| 882 | ndjson.push_str(&format!("{{\"id\": {i}, \"name\": \"user{i}\"}}\n")); |
| 883 | } |
| 884 | let ndjson_bytes = Bytes::from(ndjson); |
| 885 | let file_size = ndjson_bytes.len() as u64; |
| 886 | |
| 887 | for &cs in CHUNK_SIZES { |
| 888 | let (store, path) = make_chunked_store(&ndjson_bytes, cs).await; |
| 889 | |
| 890 | for num_partitions in get_partition_splits() { |
| 891 | let batches = collect_partitioned_batches( |
| 892 | Arc::clone(&store), |
| 893 | &path, |
| 894 | file_size, |
| 895 | num_partitions, |
| 896 | ) |
| 897 | .await?; |
| 898 | |
| 899 | let total: usize = batches.iter().map(|b| b.num_rows()).sum(); |
| 900 | assert_eq!( |
| 901 | total, num_rows, |
| 902 | "Expected {num_rows} rows with {num_partitions} partitions" |
| 903 | ); |
| 904 | |
| 905 | let result = concat_and_sort_by_id(&batches)?; |
| 906 | let ids = result |
| 907 | .column(0) |
| 908 | .as_any() |
| 909 | .downcast_ref::<Int64Array>() |
| 910 | .unwrap(); |
| 911 | let names = result |
| 912 | .column(1) |
| 913 | .as_any() |
| 914 | .downcast_ref::<StringArray>() |
| 915 | .unwrap(); |
| 916 | for i in 0..num_rows { |
| 917 | assert_eq!( |
| 918 | ids.value(i), |
| 919 | i as i64, |
| 920 | "id mismatch at row {i} with {num_partitions} partitions" |
| 921 | ); |
| 922 | assert_eq!( |
| 923 | names.value(i), |
| 924 | format!("user{i}"), |
| 925 | "name mismatch at row {i} with {num_partitions} partitions" |
| 926 | ); |
| 927 | } |
| 928 | } |
| 929 | } |
| 930 | |
| 931 | Ok(()) |
| 932 | } |
| 933 | |
| 934 | #[tokio::test] |
nothing calls this directly
no test coverage detected
searching dependent graphs…