MCPcopy Index your code
hub / github.com/clflushopt/tpchgen-rs

github.com/clflushopt/tpchgen-rs @v3.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.0.0 ↗ · + Follow
2,508 symbols 5,433 edges 215 files 661 documented · 26%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

tpchgen-rs

Apache licensed Build Status

Blazing fast TPCH benchmark data generator, in pure Rust with zero dependencies.

Features

  1. Blazing Speed 🚀
  2. Obsessively Tested 📋
  3. Fully parallel, streaming, constant memory usage 🧠

Try it now

The easiest way to use this software is via the [tpchgen-cli] tool.

Performance

[tpchgen-cli] is more than 10x faster than the next fastest TPCH generator we know of. On a 2023 Mac M3 Max laptop, it easily generates data faster than can be written to SSD. See BENCHMARKS.md for more details on performance and benchmarking.

Times to create TPCH tables in Parquet format using tpchgen-cli and duckdb for various scale factors.

Scale Factor tpchgen-cli DuckDB DuckDB (proprietary)
1 0:02.24 0:12.29 0:10.68
10 0:09.97 1:46.80 1:41.14
100 1:14.22 17:48.27 16:40.88
1000 10:26.26 N/A (OOM) N/A (OOM)
  • DuckDB (proprietary) is the time required to create TPCH data using the proprietary DuckDB format
  • Creating Scale Factor 1000 using DuckDB required 647 GB of memory, which is why it is not included in the table above.

Parquet Generation Performance

Answers

The core tpchgen crate provides answers for queries 1 to 22 and for a scale factor of 1. The answers exposed were derived from the TPC-H Tools official distribution.

Testing

This crate has extensive tests to ensure correctness and produces exactly the same, byte-for-byte output as the original [dbgen] implementation. We compare the output of this crate with [dbgen] as part of every checkin. See TESTING.md for more details on testing methodology

Crates

  • tpchgen: the core data generator logic for TPC-H. It has no dependencies and is easy to embed in other Rust project.

  • tpchgen-arrow generates TPC-H data in Apache Arrow format. It depends on the arrow-rs library

  • tpchgen-cli is a [dbgen] compatible CLI tool that generates benchmark dataset using multiple processes.

Contributing

Pull requests are welcome. For major changes, please open an issue first for discussion. See our contributors guide for more details.

Architecture

Please see architecture guide for details on how the code is structured.

License

The project is licensed under the APACHE 2.0 license.

References

  • The TPC-H Specification, see the specification page.
  • The Original dbgen Implementation you must submit an official request to access the software dbgen at their official website

Extension points exported contracts — how you extend this code

RecordBatchIterator (Interface)
An iterator of Arrow [`RecordBatch`]es that also exposes its schema. [25 implementers]
tpcdsgen-arrow/src/lib.rs
GeneratorColumn (Interface)
GeneratorColumns are columns that are used only within the context of the generator logic. The Enums that implement this [26 …
tpcdsgen/src/generator/generator_column.rs
RecordBatchIterator (Interface)
Iterator of Arrow [`RecordBatch`] that also knows its schema [8 implementers]
tpchgen-arrow/src/lib.rs
ProgressTracker (Interface)
(no doc) [7 implementers]
tpchgen-cli/src/progress.rs
RowType (Interface)
Common trait for writing rows in TBL and CSV format
tpchgen-arrow/tests/reparse.rs
Column (Interface)
Column trait for TPC-DS table columns. Used by column enums (CallCenterColumn, CustomerColumn, etc.) to provide common f [8 …
tpcdsgen/src/column/mod.rs
Sink (Interface)
Something that can write the contents of a buffer somewhere For example, this is implemented for a file writer. [2 implementers]
tpchgen-cli/src/generate.rs
TableRow (Interface)
TableRow trait matching the Java TableRow interface Represents a single row of data from any TPC-DS table [27 implementers]
tpcdsgen/src/row/table_row.rs

Core symbols most depended-on inside this repo

opt
called by 221
tpcdsgen-arrow/src/conversions.rs
get_random_number_stream
called by 216
tpcdsgen/src/row/abstract_row_generator.rs
iter
called by 167
tpchgen/src/generators.rs
sk_opt
called by 119
tpcdsgen-arrow/src/conversions.rs
decimal_to_i128
called by 75
tpcdsgen-arrow/src/conversions.rs
get_scaling
called by 74
tpcdsgen/src/config/session.rs
assert
called by 73
tpchgen-cli/src/plan.rs
get_row_count
called by 71
tpcdsgen/src/config/scaling.rs

Shape

Method 1,566
Function 629
Class 240
Enum 59
Interface 14

Languages

Rust100%

Modules by API surface

tpchgen/src/generators.rs68 symbols
tpchgen-cli/src/plan.rs61 symbols
tpcdsgen/src/row/tables/call_center_row.rs61 symbols
tpchgen/src/distribution.rs42 symbols
tpcdsgen/src/distribution/items_distributions.rs41 symbols
tpcdsgen/src/types/pricing.rs40 symbols
tpcdsgen/src/types/date.rs40 symbols
tpchgen-cli/tests/cli_integration.rs38 symbols
tpchgen-cli/src/lib.rs35 symbols
tpcdsgen/src/config/session.rs35 symbols
tpcdsgen/src/types/address.rs34 symbols
tpcdsgen/src/table.rs31 symbols

For agents

$ claude mcp add tpchgen-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact