()
| 1002 | |
| 1003 | #[tokio::test] |
| 1004 | async fn test_write_partitioned() { |
| 1005 | let file_io = test_file_io(); |
| 1006 | let table_path = "memory:/test_table_write_partitioned"; |
| 1007 | setup_dirs(&file_io, table_path).await; |
| 1008 | |
| 1009 | let table = test_partitioned_table(&file_io, table_path); |
| 1010 | let mut table_write = TableWrite::new(&table, "test-user".to_string()).unwrap(); |
| 1011 | |
| 1012 | let batch = make_partitioned_batch(vec!["a", "b", "a"], vec![1, 2, 3]); |
| 1013 | table_write.write_arrow_batch(&batch).await.unwrap(); |
| 1014 | |
| 1015 | let messages = table_write.prepare_commit().await.unwrap(); |
| 1016 | // Should have 2 commit messages (one per partition) |
| 1017 | assert_eq!(messages.len(), 2); |
| 1018 | |
| 1019 | let total_rows: i64 = messages |
| 1020 | .iter() |
| 1021 | .flat_map(|m| &m.new_files) |
| 1022 | .map(|f| f.row_count) |
| 1023 | .sum(); |
| 1024 | assert_eq!(total_rows, 3); |
| 1025 | |
| 1026 | // Commit and verify |
| 1027 | let commit = TableCommit::new(table, "test-user".to_string()); |
| 1028 | commit.commit(messages).await.unwrap(); |
| 1029 | |
| 1030 | let snap_manager = SnapshotManager::new(file_io.clone(), table_path.to_string()); |
| 1031 | let snapshot = snap_manager.get_latest_snapshot().await.unwrap().unwrap(); |
| 1032 | assert_eq!(snapshot.id(), 1); |
| 1033 | assert_eq!(snapshot.total_record_count(), Some(3)); |
| 1034 | } |
| 1035 | |
| 1036 | #[tokio::test] |
| 1037 | async fn test_write_empty_batch() { |
nothing calls this directly
no test coverage detected