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

Function test_write_and_commit

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

Source from the content-addressed store, hash-verified

807
808 #[tokio::test]
809 async fn test_write_and_commit() {
810 let file_io = test_file_io();
811 let table_path = "memory:/test_table_write";
812 setup_dirs(&file_io, table_path).await;
813
814 let table = test_table(&file_io, table_path);
815 let mut table_write = TableWrite::new(&table, "test-user".to_string()).unwrap();
816
817 let batch = make_batch(vec![1, 2, 3], vec![10, 20, 30]);
818 table_write.write_arrow_batch(&batch).await.unwrap();
819
820 let messages = table_write.prepare_commit().await.unwrap();
821 assert_eq!(messages.len(), 1);
822 assert_eq!(messages[0].bucket, 0);
823 assert_eq!(messages[0].new_files.len(), 1);
824 assert_eq!(messages[0].new_files[0].row_count, 3);
825
826 // Commit and verify snapshot
827 let commit = TableCommit::new(table, "test-user".to_string());
828 commit.commit(messages).await.unwrap();
829
830 let snap_manager = SnapshotManager::new(file_io.clone(), table_path.to_string());
831 let snapshot = snap_manager.get_latest_snapshot().await.unwrap().unwrap();
832 assert_eq!(snapshot.id(), 1);
833 assert_eq!(snapshot.total_record_count(), Some(3));
834 }
835
836 #[test]
837 fn test_allows_append_blob_table() {

Callers

nothing calls this directly

Calls 8

write_arrow_batchMethod · 0.80
get_latest_snapshotMethod · 0.80
test_file_ioFunction · 0.70
setup_dirsFunction · 0.70
test_tableFunction · 0.70
make_batchFunction · 0.70
prepare_commitMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected