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
impl Preparer
Sourcepub fn prepare(&self, parts: Vec<((u64, u64), Chunk)>) -> Result<Prepared>
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.
Sourcepub fn start(&self) -> Building
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.
Sourcepub fn feed(
&self,
building: &mut Building,
parts: Vec<((u64, u64), Chunk)>,
) -> Result<()>
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.