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

Method write

crates/paimon/src/btree/writer.rs:97–121  ·  view source on GitHub ↗

Write a key and its associated row id. If key is None, the row id is added to the null bitmap. Keys must be written in sorted order; entries with the same key are combined.

(&mut self, key: Option<&[u8]>, row_id: i64)

Source from the content-addressed store, hash-verified

95 /// If key is None, the row id is added to the null bitmap.
96 /// Keys must be written in sorted order; entries with the same key are combined.
97 pub async fn write(&mut self, key: Option<&[u8]>, row_id: i64) -> io::Result<()> {
98 self.row_count += 1;
99
100 match key {
101 None => {
102 self.null_bitmap
103 .get_or_insert_with(RoaringTreemap::new)
104 .insert(row_id as u64);
105 }
106 Some(k) => {
107 if let Some(ref last) = self.last_key {
108 if (self.key_comparator)(k, last) != Ordering::Equal {
109 self.flush_row_ids().await?;
110 }
111 }
112 self.last_key = Some(k.to_vec());
113 self.current_row_ids.push(row_id);
114
115 if self.first_key.is_none() {
116 self.first_key = Some(k.to_vec());
117 }
118 }
119 }
120 Ok(())
121 }
122
123 /// Flush accumulated row ids for the current key.
124 async fn flush_row_ids(&mut self) -> io::Result<()> {

Callers 15

write_int_parquet_fileFunction · 0.45
register_temp_tableMethod · 0.45
sqlMethod · 0.45
write_column_indexesFunction · 0.45
write_bytesMethod · 0.45
test_duplicate_keysFunction · 0.45
test_null_keysFunction · 0.45
test_only_nullsFunction · 0.45
test_equal_queryFunction · 0.45
test_range_queriesFunction · 0.45
test_not_equal_queryFunction · 0.45

Calls 3

insertMethod · 0.80
flush_row_idsMethod · 0.80
to_vecMethod · 0.80

Tested by 15

write_int_parquet_fileFunction · 0.36
test_duplicate_keysFunction · 0.36
test_null_keysFunction · 0.36
test_only_nullsFunction · 0.36
test_equal_queryFunction · 0.36
test_range_queriesFunction · 0.36
test_not_equal_queryFunction · 0.36
test_in_queryFunction · 0.36
test_string_keysFunction · 0.36
test_string_keys_queryFunction · 0.36
test_large_datasetFunction · 0.36