rasinmuhammed's picture
Retail star schema v1
7e5adcc verified
|
Raw History Blame Contribute Delete
4.29 kB
---
license: cc-by-4.0
pretty_name: Retail star schema with a verified answer key
language:
- en
size_categories:
- 1M<n<10M
task_categories:
- table-question-answering
tags:
- synthetic
- retail
- star-schema
- olap
- clickhouse
- duckdb
- text-to-sql
- benchmark
- evaluation
configs:
- config_name: questions
data_files: answer_key/answer_key.csv
default: true
- config_name: orders
data_files: data/parquet/orders.parquet
- config_name: order_lines
data_files: data/parquet/order_lines.parquet
- config_name: returns
data_files: data/parquet/returns.parquet
- config_name: dim_date
data_files: data/parquet/dim_date.parquet
- config_name: dim_product
data_files: data/parquet/dim_product.parquet
- config_name: dim_customer
data_files: data/parquet/dim_customer.parquet
- config_name: dim_store
data_files: data/parquet/dim_store.parquet
---
# Retail star schema with an answer key
A synthetic retail sales star schema for ClickHouse (1.2 million orders, 3 million order lines, January 2023 to June
2026) and 60 questions, each with its SQL and one checked answer. It tests whether an agent, a cube or a model
computes the right number. Read `DATASET_CARD.md` first: the tables, the measure definitions the answers use, and how the
data was made and checked.
## Download
The whole package as one file: [`retail_star_v1.zip`](https://huggingface.co/datasets/misatadata/retail-star-answer-key/resolve/main/retail_star_v1.zip) (128 MB).
The same files, laid out as below, with the Hugging Face CLI:
```bash
hf download misatadata/retail-star-answer-key --repo-type dataset --local-dir retail-star
```
## What is in the package
| Path | What |
|---|---|
| `data/parquet/*.parquet` | one file per table, zstd, exact decimals |
| `data/csv/*.csv` | the same tables as CSVWithNames, `\N` for NULL |
| `data/ROWCOUNTS`, `data/MANIFEST.json` | rows per table; every file's rows, size and SHA-256 |
| `clickhouse/ddl.sql`, `clickhouse/load.sh` | the tables (MergeTree, pinned types) and a loader that checks row counts |
| `answer_key/questions.jsonl` | one record per question: the question, the measure definitions it uses, SQL for ClickHouse and DuckDB, the expected value, its tolerance, the traps it tests |
| `answer_key/answer_key.md`, `answer_key.csv` | the same, as a table |
| `DATASET_CARD.md` | tables, definitions, as-of date, how it was made and verified |
| `PATTERNS.md` | the planted patterns and traps, measured; for the person grading, not for agents |
| `calibration/` | the price calibration: aggregates of US retail listings per kind of product, and the script that makes them |
| `LICENSE` | CC BY 4.0: use, share and adapt it for any purpose, with credit |
## Load into ClickHouse
With ClickHouse running in Docker as `clickhouse`:
```bash
CLICKHOUSE_CLIENT="docker exec -i clickhouse clickhouse-client" clickhouse/load.sh parquet
```
With `clickhouse-client` on the path, `clickhouse/load.sh parquet` is enough. `clickhouse/load.sh csv` loads the CSV
files instead. The loader creates the tables, loads each one, and checks every table's row count against
`data/ROWCOUNTS`. It skips tables it has already loaded; `--reset` drops them and starts over. `CH_DATABASE` picks a
database other than `default`.
Plain `INSERT ... FORMAT Parquet` works as well; keep `input_format_null_as_default=0` so NULL customer ids and segments
stay NULL instead of becoming 0 and ''.
## Query without loading
DuckDB reads the Parquet files directly, and every question has DuckDB SQL beside the ClickHouse SQL:
```sql
CREATE VIEW order_lines AS SELECT * FROM 'data/parquet/order_lines.parquet';
```
## Grading
Compare an answer with `expected` within `tolerance` (`questions.jsonl`): money exact to the cent, averages of money
within ±0.01, ratios within ±0.0001, members by exact name. Every answer was computed on ClickHouse 24.3, 26.8 and 26.9
and on DuckDB and checked equal, and a sample was recomputed without SQL. `PATTERNS.md` lists what a wrong answer
usually looks like, so a failure can be put down to the agent, the model or the dataset.
## License
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (`LICENSE`). Credit it as "Retail star schema with a verified
answer key, generated with Misata Studio (misata.studio), CC BY 4.0".