科研技能库/数据集管理器
实验设计
未发现用户侧风险

数据集管理器

使用此技能生成基准数据集(TPC-H、TPC-DS 等)。当用户需要特定规模因子的测试数据进行基准测试或测试时触发。支持 parquet 和 duckdb 输出格式。

文件预览

1 个文件
SKILL.md
2.7 KB · 可预览
---
name: dataset-manager
description: >
  Use this skill to generate benchmark datasets (TPC-H, TPC-DS, etc.). Trigger when the user
  needs test data at a specific scale factor for benchmarking or testing. Supports parquet and
  duckdb output formats.
argument-hint: "[benchmark] [scale_factor] [--format duckdb|parquet] [--output <path>]"
---

# Dataset Generator

Generate benchmark datasets by running the corresponding shell script under `test/<benchmark>_performance/`.

## Gather Parameters

Parse `$ARGUMENTS` for:
- **Benchmark**: name from the registry below (first positional arg)
- **Scale factor**: integer (second positional arg)
- **Format**: `--format duckdb|parquet` (optional — each benchmark has a default)
- **Output path**: `--output <path>` (optional — scripts have sensible defaults)

If any required parameter (benchmark, scale factor) is missing, ask the user.

## Benchmark Registry

Each entry follows the same structure: script location, command template, supported formats, defaults, and prerequisites.

<!-- To add a new benchmark: copy an existing entry, fill in the fields, and update the description frontmatter. -->

### TPC-H

| Field | Value |
|-------|-------|
| Script | `test/tpch_performance/generate_tpch_data.sh` |
| Default format | `parquet` |
| Formats | `parquet` (tpchgen-rs), `duckdb` (DuckDB `dbgen()`) |
| Default output (parquet) | `test_datasets/tpch_parquet_sf<SF>` |
| Default output (duckdb) | `test_datasets/tpch_sf<SF>.duckdb` |
| Prerequisites | Parquet: pixi env (rust, python, pyarrow). DuckDB: `build/release/duckdb` |

```bash
cd test/tpch_performance && pixi run bash generate_tpch_data.sh <SF> --format <FORMAT> [--output <path>]
```

Notes:
- If the parquet output directory already exists, the script skips generation

### TPC-DS

| Field | Value |
|-------|-------|
| Script | `test/tpcds_performance/generate_tpcds_data.sh` |
| Default format | `duckdb` |
| Formats | `duckdb`, `parquet` |
| Default output (duckdb) | `test_datasets/tpcds_sf<SF>.duckdb` |
| Default output (parquet) | `test_datasets/tpcds_parquet_sf<SF>` |
| Prerequisites | `build/release/duckdb` |

```bash
cd test/tpcds_performance && bash generate_tpcds_data.sh <SF> --format <FORMAT> [--output <path>]
```

Notes:
- Also extracts TPC-DS query files to `test/tpcds_performance/queries/q{1..99}.sql`

## Prerequisites

For any benchmark that requires the DuckDB binary, check before running:
```bash
test -x build/release/duckdb
```
If missing, tell the user to build first: `CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) make`

## Report Results

- Benchmark name
- Output path
- Format used
- Whether generation was skipped (output already existed) or completed

SKILL.md

元数据
namedataset-manager
description使用此技能生成基准数据集(TPC-H、TPC-DS 等)。当用户需要特定规模因子的测试数据进行基准测试或测试时触发。支持 parquet 和 duckdb 输出格式。
argument-hint[benchmark] [scale_factor] [--format duckdb|parquet] [--output <path>]

数据集生成器

通过运行 test/<benchmark>_performance/ 下对应的 Shell 脚本生成基准数据集。

收集参数

从 $ARGUMENTS 解析以下内容:

  • 基准测试:下方注册表中的名称(第一个位置参数)
  • 规模因子:整数(第二个位置参数)
  • 格式:--format duckdb|parquet(可选 — 每种基准测试都有默认值)
  • 输出路径:--output <path>(可选 — 脚本有合理默认值)

若缺少任何必填参数(基准测试、规模因子),则向用户询问。

基准测试注册表

每个条目遵循相同结构:脚本位置、命令模板、支持的格式、默认值与前置条件。

<!-- 添加新基准测试时:复制现有条目,填写字段,并更新 description 前言。 -->

TPC-H

字段值
脚本test/tpch_performance/generate_tpch_data.sh
默认格式parquet
支持的格式parquet(tpchgen-rs)、duckdb(DuckDB dbgen())
默认输出(parquet)test_datasets/tpch_parquet_sf<SF>
默认输出(duckdb)test_datasets/tpch_sf<SF>.duckdb
前置条件Parquet:pixi 环境(rust、python、pyarrow)。DuckDB:build/release/duckdb
bash
cd test/tpch_performance && pixi run bash generate_tpch_data.sh <SF> --format <FORMAT> [--output <path>]

注意:

  • 若 parquet 输出目录已存在,脚本将跳过生成

TPC-DS

字段值
脚本test/tpcds_performance/generate_tpcds_data.sh
默认格式duckdb
支持的格式duckdb、parquet
默认输出(duckdb)test_datasets/tpcds_sf<SF>.duckdb
默认输出(parquet)test_datasets/tpcds_parquet_sf<SF>
前置条件build/release/duckdb
bash
cd test/tpcds_performance && bash generate_tpcds_data.sh <SF> --format <FORMAT> [--output <path>]

注意:

  • 同时会将 TPC-DS 查询文件解压至 test/tpcds_performance/queries/q{1..99}.sql

前置条件

针对需要 DuckDB 二进制文件的基准测试,运行前请检查:

bash
test -x build/release/duckdb

若缺失,请告知用户先行构建:CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) make

报告结果

  • 基准测试名称
  • 输出路径
  • 使用的格式
  • 生成是被跳过(输出已存在)还是已完成