()
| 1327 | |
| 1328 | #[tokio::test] |
| 1329 | async fn test_overwrite_partition() { |
| 1330 | let file_io = test_file_io(); |
| 1331 | let table_path = "memory:/test_overwrite_partition"; |
| 1332 | setup_dirs(&file_io, table_path).await; |
| 1333 | |
| 1334 | let commit = setup_partitioned_commit(&file_io, table_path); |
| 1335 | |
| 1336 | // Append data for partition "a" and "b" |
| 1337 | commit |
| 1338 | .commit(vec![ |
| 1339 | CommitMessage::new( |
| 1340 | partition_bytes("a"), |
| 1341 | 0, |
| 1342 | vec![test_data_file("data-a.parquet", 100)], |
| 1343 | ), |
| 1344 | CommitMessage::new( |
| 1345 | partition_bytes("b"), |
| 1346 | 0, |
| 1347 | vec![test_data_file("data-b.parquet", 200)], |
| 1348 | ), |
| 1349 | ]) |
| 1350 | .await |
| 1351 | .unwrap(); |
| 1352 | |
| 1353 | // Overwrite partition "a" with new data (dynamic partition overwrite) |
| 1354 | commit |
| 1355 | .overwrite( |
| 1356 | vec![CommitMessage::new( |
| 1357 | partition_bytes("a"), |
| 1358 | 0, |
| 1359 | vec![test_data_file("data-a2.parquet", 50)], |
| 1360 | )], |
| 1361 | None, |
| 1362 | ) |
| 1363 | .await |
| 1364 | .unwrap(); |
| 1365 | |
| 1366 | let snap_manager = SnapshotManager::new(file_io.clone(), table_path.to_string()); |
| 1367 | let snapshot = snap_manager.get_latest_snapshot().await.unwrap().unwrap(); |
| 1368 | assert_eq!(snapshot.id(), 2); |
| 1369 | assert_eq!(snapshot.commit_kind(), &CommitKind::OVERWRITE); |
| 1370 | // 300 - 100 (delete a) + 50 (add a2) = 250 |
| 1371 | assert_eq!(snapshot.total_record_count(), Some(250)); |
| 1372 | } |
| 1373 | |
| 1374 | #[tokio::test] |
| 1375 | async fn test_drop_partitions() { |
nothing calls this directly
no test coverage detected