GenerationPlan

Struct GenerationPlan 

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

A list of generator “parts” (data generator chunks, not TPCH parts) for a single output file.

Controls the parallelization and layout of Parquet files in tpchgen-cli.

§Background

A “part” is a logical partition of a particular output table. Each data generator can create parts individually.

For example, the parameters to OrderGenerator::new scale_factor, part_countandpart_counttogether define a partition of theOrder` table.

The entire output table results from generating each of the part_count parts. For example, if part_count is 10, appending parts 1 to 10 results in a complete Order table.

Interesting properties of parts:

  1. They are independent of each other, so they can be generated in parallel.
  2. They scale. So for example, parts 0..10 with a part_count of 50 will generate the same data as parts 1 with a part_count of 5.

§Implication for tpchgen-cli

For tbl and csv files, tpchgen-cli generates num-threads parts in parallel.

For Parquet files, the output file has one row group for each “part”.

§Example

use tpchgen_cli::{GenerationPlan, OutputFormat, Table};

let plan = GenerationPlan::try_new(
  Table::Orders,
  OutputFormat::Parquet,
  1.0, // scale factor
  Some(-1), // cli_part
  Some(-1), // cli_parts
   0,
 );
let results = plan.into_iter().collect::<Vec<_>>();
/// assert_eq!(results.len(), 1);

Implementations§

Source§

impl GenerationPlan

Source

pub fn try_new( table: Table, format: OutputFormat, scale_factor: f64, cli_part: Option<i32>, cli_part_count: Option<i32>, parquet_row_group_bytes: i64, ) -> Result<Self, String>

Returns a GenerationPlan number of parts to generate

§Arguments
  • cli_part: optional part number to generate (1-based), --part CLI argument
  • cli_part_count: optional total number of parts, --parts CLI argument
  • parquet_row_group_size: optional parquet row group size, --parquet-row-group-size CLI argument
Source

pub fn partitioned_table(table: Table) -> bool

Return true if the tables is unpartitionable (not parameterized by part count)

Source

pub fn chunk_count(&self) -> usize

Return the number of part(ititions) this plan will generate

Trait Implementations§

Source§

impl Clone for GenerationPlan

Source§

fn clone(&self) -> GenerationPlan

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 GenerationPlan

Source§

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

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

impl Display for GenerationPlan

Source§

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

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

impl IntoIterator for GenerationPlan

Converts the GenerationPlan into an iterator of (part_number, num_parts)

Source§

type Item = (i32, i32)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<<GenerationPlan as IntoIterator>::Item>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for GenerationPlan

Source§

fn eq(&self, other: &GenerationPlan) -> 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 StructuralPartialEq for GenerationPlan

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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> Allocation for T
where T: RefUnwindSafe + Send + Sync,