MCPcopy Create free account
hub / github.com/apache/arrow-rs / encode

Function encode

arrow-row/src/variable.rs:83–92  ·  view source on GitHub ↗

Variable length values are encoded as - single `0_u8` if null - single `1_u8` if empty array - `2_u8` if not empty, followed by one or more blocks where a block is encoded as - [`BLOCK_SIZE`] bytes of string data, padded with 0s - `0xFF_u8` if this is not the last block for this string - otherwise the length of the block as a `u8`

(
    data: &mut [u8],
    offsets: &mut [usize],
    i: I,
    opts: SortOptions,
)

Source from the content-addressed store, hash-verified

81/// - `0xFF_u8` if this is not the last block for this string
82/// - otherwise the length of the block as a `u8`
83pub fn encode<'a, I: Iterator<Item = Option<&'a [u8]>>>(
84 data: &mut [u8],
85 offsets: &mut [usize],
86 i: I,
87 opts: SortOptions,
88) {
89 for (offset, maybe_val) in offsets.iter_mut().skip(1).zip(i) {
90 *offset += encode_one(&mut data[*offset..], maybe_val, opts);
91 }
92}
93
94/// Calls [`encode`] with optimized iterator for generic byte arrays
95pub(crate) fn encode_generic_byte_array<T: ByteArrayType>(

Callers 1

Calls 3

zipMethod · 0.80
encode_oneFunction · 0.70
skipMethod · 0.45

Tested by

no test coverage detected