mrpowers-io/falsa · 文件 下载 ZIP
文件最后提交记录最后更新时间
README.md
以下内容由 AI 翻译,如有问题请点此提交 issue 反馈
falsa
一个非官面的 H2O DB-like OPS benchmark 数据集 生成器的 Rust 重新实现。虽然原始的 R 脚本非常出色,但它们内存占用高,且没有提供简单的 运行方式。False 提供了一个开箱即用的 Python CLI 应用,采用 Rust 后端,并支持核心外 生成。
安装
通过 Pip 安装
pip install falsa
用法
falsa --help
Usage: falsa [OPTIONS] COMMAND [ARGS]...
H2O db-like-benchmark data generation.
This implementation is unofficial!
For the official implementation please check https://github.com/duckdblabs/db-benchmark/tree/main/_data
Available commands are:
- groupby: generate GroupBy dataset;
- join: generate three Join datasets (small, medium, big);
Author: github.com/SemyonSinchenko
Source code: https://github.com/mrpowers-io/falsa
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --install-completion Install completion for the current shell. │
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ groupby Create H2O GroupBy Dataset │
│ join Create three H2O join datasets │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
简单示例
以下是一个示例,展示如何生成一个包含 1 亿行和 9 列数据的 Parquet 文件:
falsa groupby --path-prefix=~/data --size MEDIUM

以下是文件中的前三行数据:
┌───────┬──────────┬──────────────┬─────┬─────┬────────┬─────┬─────┬───────────┐
│ id1 ┆ id2 ┆ id3 ┆ id4 ┆ id5 ┆ id6 ┆ v1 ┆ v2 ┆ v3 │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ str ┆ str ┆ i64 ┆ i64 ┆ i64 ┆ i64 ┆ i64 ┆ f64 │
╞═══════╪══════════╪══════════════╪═════╪═════╪════════╪═════╪═════╪═══════════╡
│ id038 ┆ id850817 ┆ id0000837021 ┆ 90 ┆ 8 ┆ 898164 ┆ 4 ┆ 15 ┆ 28.133477 │
│ id095 ┆ id73309 ┆ id0000312443 ┆ 3 ┆ 75 ┆ 177193 ┆ 1 ┆ 12 ┆ 91.555302 │
│ id055 ┆ id248099 ┆ id0000141631 ┆ 12 ┆ 94 ┆ 132406 ┆ 1 ┆ 3 ┆ 64.543029 │
└───────┴──────────┴──────────────┴─────┴─────┴────────┴─────┴─────┴───────────┘
使用 falsa,你可以生成许多示例数据集。
h2o 数据集
h2o 数据集用于在单机上对查询引擎进行基准测试,参见此处。
以下是生成示例数据集的原始 R 脚本。如果你知道如何运行 R,这些脚本仍然有效(如果机器内存不足,大数据集生成可能会出错)。
如果你希望使用 Python 接口生成这些数据集,或者在使用 R 脚本时遇到内存问题,falsa 是一个不错的选择。
h2o groupby 数据集
h2o groupby 数据集包含 9 列,数据行数为 1000 万/1 亿/10 亿行。
以下是三行具有代表性的数据:
┌───────┬──────────┬──────────────┬─────┬─────┬────────┬─────┬─────┬───────────┐
│ id1 ┆ id2 ┆ id3 ┆ id4 ┆ id5 ┆ id6 ┆ v1 ┆ v2 ┆ v3 │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ str ┆ str ┆ i64 ┆ i64 ┆ i64 ┆ i64 ┆ i64 ┆ f64 │
╞═══════╪══════════╪══════════════╪═════╪═════╪════════╪═════╪═════╪═══════════╡
│ id038 ┆ id850817 ┆ id0000837021 ┆ 90 ┆ 8 ┆ 898164 ┆ 4 ┆ 15 ┆ 28.133477 │
│ id095 ┆ id73309 ┆ id0000312443 ┆ 3 ┆ 75 ┆ 177193 ┆ 1 ┆ 12 ┆ 91.555302 │
│ id055 ┆ id248099 ┆ id0000141631 ┆ 12 ┆ 94 ┆ 132406 ┆ 1 ┆ 3 ┆ 64.543029 │
└───────┴──────────┴──────────────┴─────┴─────┴────────┴─────┴─────┴───────────┘
以下是各列的简要说明:
- id1: id001 到 id100 之间的 100 个不同值
- id2: id001 到 id100 之间的 100 个不同值
- id3: 1_000_000 个不同值
- id4: 零到 100 之间的随机浮点值
- id5: 零到 100 之间的随机整数值
- id6: 1 到 1_000_000 之间的随机整数值
- v1: 1 到 5 之间的整数值
- v2: 1 到 15 之间的整数值
- v3: 零到 100 之间的浮点值
以下是该表的详细说明:
┌────────────┬───────────┬───────────┬──────────────┬───────────┬───┬───────────────┬──────────┬───────────┬───────────┐
│ statistic ┆ id1 ┆ id2 ┆ id3 ┆ id4 ┆ … ┆ id6 ┆ v1 ┆ v2 ┆ v3 │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ str ┆ str ┆ str ┆ f64 ┆ ┆ f64 ┆ f64 ┆ f64 ┆ f64 │
╞════════════╪═══════════╪═══════════╪══════════════╪═══════════╪═══╪═══════════════╪══════════╪═══════════╪═══════════╡
│ count ┆ 100000000 ┆ 100000000 ┆ 100000000 ┆ 1e8 ┆ … ┆ 1e8 ┆ 1e8 ┆ 1e8 ┆ 1e8 │
│ null_count ┆ 0 ┆ 0 ┆ 0 ┆ 0.0 ┆ … ┆ 0.0 ┆ 0.0 ┆ 0.0 ┆ 0.0 │
│ mean ┆ null ┆ null ┆ null ┆ 50.500471 ┆ … ┆ 499977.133559 ┆ 3.000173 ┆ 8.0002679 ┆ 50.000731 │
│ std ┆ null ┆ null ┆ null ┆ 28.864911 ┆ … ┆ 288668.423121 ┆ 1.414225 ┆ 4.320694 ┆ 28.868118 │
│ min ┆ id001 ┆ id001 ┆ id0000000001 ┆ 1.0 ┆ … ┆ 1.0 ┆ 1.0 ┆ 1.0 ┆ 0.000002 │
│ 25% ┆ null ┆ null ┆ null ┆ 26.0 ┆ … ┆ 249956.0 ┆ 2.0 ┆ 4.0 ┆ 24.999205 │
│ 50% ┆ null ┆ null ┆ null ┆ 51.0 ┆ … ┆ 499949.0 ┆ 3.0 ┆ 8.0 ┆ 50.002307 │
│ 75% ┆ null ┆ null ┆ null ┆ 75.0 ┆ … ┆ 749987.0 ┆ 4.0 ┆ 12.0 ┆ 75.002693 │
│ max ┆ id100 ┆ id999999 ┆ id0001000000 ┆ 100.0 ┆ … ┆ 1e6 ┆ 5.0 ┆ 15.0 ┆ 100.0 │
└────────────┴───────────┴───────────┴──────────────┴───────────┴───┴───────────────┴──────────┴───────────┴───────────┘
h2o 数据集适用于 group by 基准测试。例如,你可以使用 id1 对低基数列进行聚合,并使用 id3 对高基数列进行聚合。