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

Function test_overwrite_null_partition

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

Source from the content-addressed store, hash-verified

1573
1574 #[tokio::test]
1575 async fn test_overwrite_null_partition() {
1576 let file_io = test_file_io();
1577 let table_path = "memory:/test_overwrite_null_partition";
1578 setup_dirs(&file_io, table_path).await;
1579
1580 let commit = setup_partitioned_commit(&file_io, table_path);
1581
1582 // Append data for partition "a", "b", and NULL
1583 commit
1584 .commit(vec![
1585 CommitMessage::new(
1586 partition_bytes("a"),
1587 0,
1588 vec![test_data_file("data-a.parquet", 100)],
1589 ),
1590 CommitMessage::new(
1591 partition_bytes("b"),
1592 0,
1593 vec![test_data_file("data-b.parquet", 200)],
1594 ),
1595 CommitMessage::new(
1596 null_partition_bytes(),
1597 0,
1598 vec![test_data_file("data-null.parquet", 300)],
1599 ),
1600 ])
1601 .await
1602 .unwrap();
1603
1604 // Overwrite NULL partition only — should NOT affect "a" or "b"
1605 commit
1606 .overwrite(
1607 vec![CommitMessage::new(
1608 null_partition_bytes(),
1609 0,
1610 vec![test_data_file("data-null2.parquet", 50)],
1611 )],
1612 None,
1613 )
1614 .await
1615 .unwrap();
1616
1617 let snap_manager = SnapshotManager::new(file_io.clone(), table_path.to_string());
1618 let snapshot = snap_manager.get_latest_snapshot().await.unwrap().unwrap();
1619 assert_eq!(snapshot.id(), 2);
1620 assert_eq!(snapshot.commit_kind(), &CommitKind::OVERWRITE);
1621 // 600 - 300 (delete null) + 50 (add null2) = 350
1622 assert_eq!(snapshot.total_record_count(), Some(350));
1623 }
1624
1625 #[tokio::test]
1626 async fn test_delete_conflict_rejects_missing_file() {

Callers

nothing calls this directly

Calls 6

setup_partitioned_commitFunction · 0.85
overwriteMethod · 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