MCPcopy Create free account
hub / github.com/apache/paimon-rust / test_append_commit

Function test_append_commit

crates/paimon/src/table/table_commit.rs:1212–1248  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1210
1211 #[tokio::test]
1212 async fn test_append_commit() {
1213 let file_io = test_file_io();
1214 let table_path = "memory:/test_append_commit";
1215 setup_dirs(&file_io, table_path).await;
1216
1217 let commit = setup_commit(&file_io, table_path);
1218
1219 let messages = vec![CommitMessage::new(
1220 vec![],
1221 0,
1222 vec![test_data_file("data-0.parquet", 100)],
1223 )];
1224
1225 commit.commit(messages).await.unwrap();
1226
1227 // Verify snapshot was created
1228 let snap_manager = SnapshotManager::new(file_io.clone(), table_path.to_string());
1229 let snapshot = snap_manager.get_latest_snapshot().await.unwrap().unwrap();
1230 assert_eq!(snapshot.id(), 1);
1231 assert_eq!(snapshot.commit_identifier(), BATCH_COMMIT_IDENTIFIER);
1232 assert_eq!(snapshot.total_record_count(), Some(100));
1233 assert_eq!(snapshot.delta_record_count(), Some(100));
1234
1235 // Verify manifest list was written
1236 let manifest_dir = format!("{table_path}/manifest");
1237 let delta_path = format!("{manifest_dir}/{}", snapshot.delta_manifest_list());
1238 let delta_metas = ManifestList::read(&file_io, &delta_path).await.unwrap();
1239 assert_eq!(delta_metas.len(), 1);
1240 assert_eq!(delta_metas[0].num_added_files(), 1);
1241
1242 // Verify manifest entries
1243 let manifest_path = format!("{manifest_dir}/{}", delta_metas[0].file_name());
1244 let entries = Manifest::read(&file_io, &manifest_path).await.unwrap();
1245 assert_eq!(entries.len(), 1);
1246 assert_eq!(*entries[0].kind(), FileKind::Add);
1247 assert_eq!(entries[0].file().file_name, "data-0.parquet");
1248 }
1249
1250 #[tokio::test]
1251 async fn test_multiple_appends() {

Callers

nothing calls this directly

Calls 5

setup_commitFunction · 0.85
get_latest_snapshotMethod · 0.80
test_file_ioFunction · 0.70
setup_dirsFunction · 0.70
commitMethod · 0.45

Tested by

no test coverage detected