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

Function test_truncate_table

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

Source from the content-addressed store, hash-verified

1298
1299 #[tokio::test]
1300 async fn test_truncate_table() {
1301 let file_io = test_file_io();
1302 let table_path = "memory:/test_truncate";
1303 setup_dirs(&file_io, table_path).await;
1304
1305 let commit = setup_commit(&file_io, table_path);
1306
1307 // Append some data first
1308 commit
1309 .commit(vec![CommitMessage::new(
1310 vec![],
1311 0,
1312 vec![test_data_file("data-0.parquet", 100)],
1313 )])
1314 .await
1315 .unwrap();
1316
1317 // Truncate
1318 commit.truncate_table().await.unwrap();
1319
1320 let snap_manager = SnapshotManager::new(file_io.clone(), table_path.to_string());
1321 let snapshot = snap_manager.get_latest_snapshot().await.unwrap().unwrap();
1322 assert_eq!(snapshot.id(), 2);
1323 assert_eq!(snapshot.commit_kind(), &CommitKind::OVERWRITE);
1324 assert_eq!(snapshot.total_record_count(), Some(0));
1325 assert_eq!(snapshot.delta_record_count(), Some(-100));
1326 }
1327
1328 #[tokio::test]
1329 async fn test_overwrite_partition() {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected