pub struct TpchGeneratorBuilder { /* private fields */ }Expand description
Builder for constructing a TpchGenerator
Provides a fluent interface for configuring TPC-H data generation parameters.
All builder methods can be chained, and calling build()
produces a TpchGenerator ready to generate data.
§Defaults
- Scale factor: 1.0
- Output directory: current directory (“.”)
- Tables: all 8 tables
- Format: TBL
- Threads: number of CPUs
- Parquet compression: SNAPPY
- Row group size: 7MB
§Examples
use tpchgen_cli::{TpchGenerator, Table, OutputFormat, Compression};
use std::path::PathBuf;
use ::parquet::basic::ZstdLevel;
let generator = TpchGenerator::builder()
.with_scale_factor(100.0)
.with_output_dir(PathBuf::from("/data/tpch"))
.with_tables(vec![Table::Lineitem, Table::Orders])
.with_format(OutputFormat::Parquet)
.with_parquet_compression(Compression::ZSTD(ZstdLevel::try_new(3).unwrap()))
.with_num_threads(32)
.build();
generator.generate().await?;Implementations§
Source§impl TpchGeneratorBuilder
impl TpchGeneratorBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new builder with default configuration
§Examples
use tpchgen_cli::TpchGeneratorBuilder;
let builder = TpchGeneratorBuilder::new();Sourcepub fn scale_factor(&self) -> f64
pub fn scale_factor(&self) -> f64
Returns the scale factor.
Sourcepub fn with_scale_factor(self, scale_factor: f64) -> Self
pub fn with_scale_factor(self, scale_factor: f64) -> Self
Set the scale factor (e.g., 1.0 for 1GB, 10.0 for 10GB)
Sourcepub fn with_output_dir(self, output_dir: impl Into<PathBuf>) -> Self
pub fn with_output_dir(self, output_dir: impl Into<PathBuf>) -> Self
Set the output directory
Sourcepub fn with_tables(self, tables: Vec<Table>) -> Self
pub fn with_tables(self, tables: Vec<Table>) -> Self
Set which tables to generate (default: all tables)
Sourcepub fn with_format(self, format: OutputFormat) -> Self
pub fn with_format(self, format: OutputFormat) -> Self
Set the output format (default: TBL)
Sourcepub fn with_num_threads(self, num_threads: usize) -> Self
pub fn with_num_threads(self, num_threads: usize) -> Self
Set the number of threads for parallel generation (default: number of CPUs)
Sourcepub fn with_parquet_compression(self, compression: Compression) -> Self
pub fn with_parquet_compression(self, compression: Compression) -> Self
Set Parquet compression format (default: SNAPPY)
Sourcepub fn with_parquet_row_group_bytes(self, bytes: i64) -> Self
pub fn with_parquet_row_group_bytes(self, bytes: i64) -> Self
Set target row group size in bytes for Parquet files (default: 7MB)
Sourcepub fn with_parts(self, parts: i32) -> Self
pub fn with_parts(self, parts: i32) -> Self
Set the number of partitions to generate
Sourcepub fn with_part(self, part: i32) -> Self
pub fn with_part(self, part: i32) -> Self
Set the specific partition to generate (1-based, requires parts to be set)
Sourcepub fn with_stdout(self, stdout: bool) -> Self
pub fn with_stdout(self, stdout: bool) -> Self
Write output to stdout instead of files
Sourcepub fn build(self) -> TpchGenerator
pub fn build(self) -> TpchGenerator
Build the TpchGenerator with the configured settings
Trait Implementations§
Source§impl Clone for TpchGeneratorBuilder
impl Clone for TpchGeneratorBuilder
Source§fn clone(&self) -> TpchGeneratorBuilder
fn clone(&self) -> TpchGeneratorBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more