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

Method write_binary

crates/paimon/src/spec/binary_row.rs:480–489  ·  view source on GitHub ↗

Write binary data to the variable-length part (8-byte aligned, matching Java BinaryRowWriter).

(&mut self, pos: usize, value: &[u8])

Source from the content-addressed store, hash-verified

478
479 /// Write binary data to the variable-length part (8-byte aligned, matching Java BinaryRowWriter).
480 pub fn write_binary(&mut self, pos: usize, value: &[u8]) {
481 let var_offset = self.data.len();
482 self.data.extend_from_slice(value);
483 // Pad to 8-byte word boundary (Java: roundNumberOfBytesToNearestWord)
484 let padding = (8 - (value.len() % 8)) % 8;
485 self.data.extend(std::iter::repeat_n(0u8, padding));
486 let encoded = ((var_offset as u64) << 32) | (value.len() as u64);
487 let offset = self.field_offset(pos);
488 self.data[offset..offset + 8].copy_from_slice(&encoded.to_le_bytes());
489 }
490
491 /// Write short binary data (len <= 7) inline into the fixed part.
492 pub fn write_binary_inline(&mut self, pos: usize, value: &[u8]) {

Callers 4

write_stringMethod · 0.80
write_datumMethod · 0.80
write_typed_valueFunction · 0.80

Calls 2

lenMethod · 0.45
field_offsetMethod · 0.45

Tested by

no test coverage detected