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

Function struct_encode_helper

arrow-row/src/lib.rs:1939–1973  ·  view source on GitHub ↗
(
                array: &StructArray,
                offsets: &mut [usize],
                null_sentinel: u8,
                rows: &Rows,
                null: &Row<'_>,
                data: &mut

Source from the content-addressed store, hash-verified

1937 }
1938 Encoder::Struct(rows, null) => {
1939 fn struct_encode_helper<const NO_CHILD_FIELDS: bool>(
1940 array: &StructArray,
1941 offsets: &mut [usize],
1942 null_sentinel: u8,
1943 rows: &Rows,
1944 null: &Row<'_>,
1945 data: &mut [u8],
1946 ) {
1947 let empty_row = Row {
1948 data: &[],
1949 config: &rows.config,
1950 };
1951
1952 offsets
1953 .iter_mut()
1954 .skip(1)
1955 .enumerate()
1956 .for_each(|(idx, offset)| {
1957 let (row, sentinel) = match array.is_valid(idx) {
1958 true => (
1959 if NO_CHILD_FIELDS {
1960 empty_row
1961 } else {
1962 rows.row(idx)
1963 },
1964 0x01,
1965 ),
1966 false => (*null, null_sentinel),
1967 };
1968 let end_offset = *offset + 1 + row.as_ref().len();
1969 data[*offset] = sentinel;
1970 data[*offset + 1..end_offset].copy_from_slice(row.as_ref());
1971 *offset = end_offset;
1972 })
1973 }
1974
1975 let array = as_struct_array(column);
1976 let null_sentinel = null_sentinel(opts);

Callers

nothing calls this directly

Calls 5

skipMethod · 0.45
is_validMethod · 0.45
rowMethod · 0.45
lenMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected