EncodingMask

Struct EncodingMask 

Source
pub struct EncodingMask(i32);
Expand description

A bitmask representing the Encodings 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

Source

const MAX_ENCODING: i32 = 9i32

Highest valued discriminant in the Encoding enum

Source

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.

Source

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.

Source

pub fn as_i32(&self) -> i32

Return an integer representation of this EncodingMask.

Source

pub fn new_from_encodings<'a>( encodings: impl Iterator<Item = &'a Encoding>, ) -> Self

Create a new EncodingMask from a collection of Encodings.

Source

pub fn is_set(&self, val: Encoding) -> bool

Test if a given Encoding is present in this mask.

Source

pub fn all_set<'a>(&self, encodings: impl Iterator<Item = &'a Encoding>) -> bool

Test if all Encodings in a given set are present in this mask.

Source

pub fn encodings(&self) -> impl Iterator<Item = Encoding>

Return an iterator over all Encodings present in this mask.

Source

fn mask_to_encodings_iter(mask: i32) -> impl Iterator<Item = Encoding>

Trait Implementations§

Source§

impl Clone for EncodingMask

Source§

fn clone(&self) -> EncodingMask

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EncodingMask

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EncodingMask

Source§

fn default() -> EncodingMask

Returns the “default value” for a type. Read more
Source§

impl HeapSize for EncodingMask

Source§

fn heap_size(&self) -> usize

Return the size of any bytes allocated on the heap by this object, including heap memory in those structures Read more
Source§

impl PartialEq for EncodingMask

Source§

fn eq(&self, other: &EncodingMask) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, R: ThriftCompactInputProtocol<'a>> ReadThrift<'a, R> for EncodingMask

Source§

fn read_thrift(prot: &mut R) -> Result<Self>

Read an object of type Self from the input protocol object.
Source§

impl Copy for EncodingMask

Source§

impl Eq for EncodingMask

Source§

impl StructuralPartialEq for EncodingMask

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Ungil for T
where T: Send,