Struct EncodingMask

Source
pub struct EncodingMask(/* private fields */);
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<_>>();

Implementations§

Source§

impl EncodingMask

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 insert(&mut self, val: Encoding)

Mark the given Encoding as present in this mask.

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.

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

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

Source§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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