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

Function test_write_read_roundtrip

crates/paimon/src/btree/tests.rs:50–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48
49#[tokio::test]
50async fn test_write_read_roundtrip() {
51 let buf = VecFileWrite::new();
52 let mut writer = BTreeIndexWriter::new(Box::new(buf.clone()), 64, BlockCompressionType::None);
53
54 for i in 0..100 {
55 let key = int_key(i);
56 writer.write(Some(&key), i as i64).await.unwrap();
57 }
58
59 let result = writer.finish().await.unwrap();
60 assert_eq!(result.row_count, 100);
61 assert!(!result.meta.has_nulls);
62
63 let reader = write_and_open(&buf, &result, int_cmp).await;
64
65 // Spot check via queries
66 let bm = reader.query_equal(&int_key(0)).await.unwrap();
67 assert!(bm.contains(0));
68 let bm = reader.query_equal(&int_key(99)).await.unwrap();
69 assert!(bm.contains(99));
70 let all = reader.all_non_null_rows().await.unwrap();
71 assert_eq!(all.len(), 100);
72}
73
74#[tokio::test]
75async fn test_duplicate_keys() {

Callers

nothing calls this directly

Calls 6

int_keyFunction · 0.85
write_and_openFunction · 0.85
query_equalMethod · 0.80
all_non_null_rowsMethod · 0.80
writeMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected