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

Function test_postpone_write_and_commit

crates/paimon/src/table/table_write.rs:1639–1664  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1637
1638 #[tokio::test]
1639 async fn test_postpone_write_and_commit() {
1640 let file_io = test_file_io();
1641 let table_path = "memory:/test_postpone_write";
1642 setup_dirs(&file_io, table_path).await;
1643
1644 let table = test_postpone_pk_table(&file_io, table_path);
1645 let mut table_write = TableWrite::new(&table, "test-user".to_string()).unwrap();
1646
1647 let batch = make_batch(vec![3, 1, 2], vec![30, 10, 20]);
1648 table_write.write_arrow_batch(&batch).await.unwrap();
1649
1650 let messages = table_write.prepare_commit().await.unwrap();
1651 assert_eq!(messages.len(), 1);
1652 assert_eq!(messages[0].bucket, POSTPONE_BUCKET);
1653 assert_eq!(messages[0].new_files.len(), 1);
1654 assert_eq!(messages[0].new_files[0].row_count, 3);
1655
1656 // Commit and verify snapshot
1657 let commit = TableCommit::new(table, "test-user".to_string());
1658 commit.commit(messages).await.unwrap();
1659
1660 let snap_manager = SnapshotManager::new(file_io.clone(), table_path.to_string());
1661 let snapshot = snap_manager.get_latest_snapshot().await.unwrap().unwrap();
1662 assert_eq!(snapshot.id(), 1);
1663 assert_eq!(snapshot.total_record_count(), Some(3));
1664 }
1665
1666 #[tokio::test]
1667 async fn test_postpone_write_empty_batch() {

Callers

nothing calls this directly

Calls 8

test_postpone_pk_tableFunction · 0.85
write_arrow_batchMethod · 0.80
get_latest_snapshotMethod · 0.80
test_file_ioFunction · 0.70
setup_dirsFunction · 0.70
make_batchFunction · 0.70
prepare_commitMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected