Skip to main content

Preparer

Struct Preparer 

Source
pub struct Preparer { /* private fields */ }
Expand description

Encodes stripes for one Writer without the writer.

Handed out by Writer::preparer and cheap to hold. It shares with its writer which varchar columns still have a global dictionary, so a stripe prepared after the first one decided a column should not have one is encoded plainly from the start.

Implementations§

Source§

impl Preparer

Source

pub fn prepare(&self, parts: Vec<((u64, u64), Chunk)>) -> Result<Prepared>

Encodes a run of chunks as one stripe, as far as it can be without the writer.

The run is what Writer::append_stripe takes, and the rules are the same: it is a stripe of its own, and the orders have to come out in source order once the stripes are sorted. An empty chunk is dropped.

§Errors

If the run is longer than STRIPE_PARTS, a chunk’s columns are not the table’s, or one cannot be encoded.

Source

pub fn start(&self) -> Building

Starts a stripe that will be handed over a few parts at a time.

Preparer::prepare takes a stripe whole, which means a caller holds every part of it decoded until the last one arrives, and every load instance holds one. Here each batch is encoded as it comes and let go, so what an instance holds is one batch of rows and what it has built from the batches before. The stripe comes out the same: the parts of a column go through the same steps in the same order, only with the rows of later parts not yet in memory.

Whether a column is coded against its global dictionary is read here, once, so every part of the stripe is encoded the same way even if the column is demoted while it is being built. A stripe that ends up coded against a dictionary its column no longer has is encoded again plainly at the merge, which is what happens to a stripe prepared whole at the same moment.

Source

pub fn feed( &self, building: &mut Building, parts: Vec<((u64, u64), Chunk)>, ) -> Result<()>

Encodes the next few parts of a stripe that was started with Preparer::start.

The same rules as Preparer::prepare: the orders come in source order, an empty chunk is dropped, and the stripe holds no more than STRIPE_PARTS in all.

§Errors

If the stripe would hold too many parts, a chunk’s columns are not the table’s, or one cannot be encoded.

Source

pub fn finish(&self, building: Building) -> Result<Prepared>

Ends a stripe that was started with Preparer::start, ready for the merge.

§Errors

If a column’s worker panicked.

Trait Implementations§

Source§

impl Clone for Preparer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Preparer

Source§

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

Formats the value using the given formatter. Read more

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<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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.