Skip to main content

decode_as

Function decode_as 

Source
pub fn decode_as<T: Lane>(bytes: &[u8]) -> Result<Vec<T>>
Expand description

Decodes one encoded chunk straight into the integer type a column is declared at.

The same values decode gives, without the i64 in between. A reader that wants a SMALLINT column used to fill eight bytes a row with zeros, write every value into them, and then copy the lot into two bytes a row, which on ClickBench Q1 was a fifth of the query. Constant, packed, sparse and run length chunks are written in the target type directly. The other kinds decode as before and are narrowed after, since they are rare at the top of a column.

ยงErrors

As decode, or if a value does not fit in T, which is a chunk that disagrees with the type it was written for.