pub trait ColumnValueDecoder {
type Buffer;
// Required methods
fn new(col: &ColumnDescPtr) -> Self;
fn set_dict(
&mut self,
buf: Bytes,
num_values: u32,
encoding: Encoding,
is_sorted: bool,
) -> Result<()>;
fn set_data(
&mut self,
encoding: Encoding,
data: Bytes,
num_levels: usize,
num_values: Option<usize>,
) -> Result<()>;
fn read(
&mut self,
out: &mut Self::Buffer,
num_values: usize,
) -> Result<usize>;
fn skip_values(&mut self, num_values: usize) -> Result<usize>;
}
Expand description
Decodes value data
Required Associated Types§
Required Methods§
Sourcefn new(col: &ColumnDescPtr) -> Self
fn new(col: &ColumnDescPtr) -> Self
Create a new ColumnValueDecoder
Sourcefn set_dict(
&mut self,
buf: Bytes,
num_values: u32,
encoding: Encoding,
is_sorted: bool,
) -> Result<()>
fn set_dict( &mut self, buf: Bytes, num_values: u32, encoding: Encoding, is_sorted: bool, ) -> Result<()>
Set the current dictionary page
Sourcefn set_data(
&mut self,
encoding: Encoding,
data: Bytes,
num_levels: usize,
num_values: Option<usize>,
) -> Result<()>
fn set_data( &mut self, encoding: Encoding, data: Bytes, num_levels: usize, num_values: Option<usize>, ) -> Result<()>
Set the current data page
encoding
- the encoding of the pagedata
- a point to the page’s uncompressed value datanum_levels
- the number of levels contained within the page, i.e. values including nullsnum_values
- the number of non-null values contained within the page (V2 page only)
Note: data encoded with Encoding::RLE
may not know its exact length, as the final
run may be zero-padded. As such if num_values
is not provided (i.e. None
),
subsequent calls to ColumnValueDecoder::read
may yield more values than
non-null definition levels within the page
Sourcefn read(&mut self, out: &mut Self::Buffer, num_values: usize) -> Result<usize>
fn read(&mut self, out: &mut Self::Buffer, num_values: usize) -> Result<usize>
Read up to num_values
values into out
§Panics
Implementations may panic if range
overlaps with already written data
Sourcefn skip_values(&mut self, num_values: usize) -> Result<usize>
fn skip_values(&mut self, num_values: usize) -> Result<usize>
Skips over num_values
values
Returns the number of values skipped
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.