pub struct EncodingMask(i32);
Expand description
A bitmask representing the Encoding
s employed while encoding a Parquet column chunk.
The Parquet ColumnMetaData
struct contains an array that indicates what encodings were
used when writing that column chunk. For memory and performance reasons, this crate reduces
that array to bitmask, where each bit position represents a different Encoding
. This
struct contains that bitmask, and provides methods to interact with the data.
§Example
// read parquet metadata from a file
let file = open_parquet_file("some_path.parquet");
let mut reader = ParquetMetaDataReader::new();
reader.try_parse(&file).unwrap();
let metadata = reader.finish().unwrap();
// find the encodings used by the first column chunk in the first row group
let col_meta = metadata.row_group(0).column(0);
let encodings = col_meta.encodings_mask();
// check to see if a particular encoding was used
let used_rle = encodings.is_set(Encoding::RLE);
// check to see if all of a set of encodings were used
let used_all = encodings.all_set([Encoding::RLE, Encoding::PLAIN].iter());
// convert mask to a Vec<Encoding>
let encodings_vec = encodings.encodings().collect::<Vec<_>>();
Tuple Fields§
§0: i32
Implementations§
Source§impl EncodingMask
impl EncodingMask
Sourceconst MAX_ENCODING: i32 = 9i32
const MAX_ENCODING: i32 = 9i32
Highest valued discriminant in the Encoding
enum
Sourceconst ALLOWED_MASK: u32 = 4_294_966_274u32
const ALLOWED_MASK: u32 = 4_294_966_274u32
A mask consisting of unused bit positions, used for validation. This includes the never
used GROUP_VAR_INT encoding value of 1
.
Sourcepub fn try_new(val: i32) -> Result<Self>
pub fn try_new(val: i32) -> Result<Self>
Attempt to create a new EncodingMask
from an integer.
This will return an error if a bit outside the allowable range is set.
Sourcepub fn new_from_encodings<'a>(
encodings: impl Iterator<Item = &'a Encoding>,
) -> Self
pub fn new_from_encodings<'a>( encodings: impl Iterator<Item = &'a Encoding>, ) -> Self
Create a new EncodingMask
from a collection of Encoding
s.
Sourcepub fn all_set<'a>(&self, encodings: impl Iterator<Item = &'a Encoding>) -> bool
pub fn all_set<'a>(&self, encodings: impl Iterator<Item = &'a Encoding>) -> bool
Test if all Encoding
s in a given set are present in this mask.
Sourcepub fn encodings(&self) -> impl Iterator<Item = Encoding>
pub fn encodings(&self) -> impl Iterator<Item = Encoding>
Return an iterator over all Encoding
s present in this mask.
fn mask_to_encodings_iter(mask: i32) -> impl Iterator<Item = Encoding>
Trait Implementations§
Source§impl Clone for EncodingMask
impl Clone for EncodingMask
Source§fn clone(&self) -> EncodingMask
fn clone(&self) -> EncodingMask
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for EncodingMask
impl Debug for EncodingMask
Source§impl Default for EncodingMask
impl Default for EncodingMask
Source§fn default() -> EncodingMask
fn default() -> EncodingMask
Source§impl HeapSize for EncodingMask
impl HeapSize for EncodingMask
Source§impl PartialEq for EncodingMask
impl PartialEq for EncodingMask
Source§impl<'a, R: ThriftCompactInputProtocol<'a>> ReadThrift<'a, R> for EncodingMask
impl<'a, R: ThriftCompactInputProtocol<'a>> ReadThrift<'a, R> for EncodingMask
Source§fn read_thrift(prot: &mut R) -> Result<Self>
fn read_thrift(prot: &mut R) -> Result<Self>
Self
from the input protocol object.impl Copy for EncodingMask
impl Eq for EncodingMask
impl StructuralPartialEq for EncodingMask
Auto Trait Implementations§
impl Freeze for EncodingMask
impl RefUnwindSafe for EncodingMask
impl Send for EncodingMask
impl Sync for EncodingMask
impl Unpin for EncodingMask
impl UnwindSafe for EncodingMask
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more