| --- |
| dataset_info: |
| features: |
| - name: id |
| dtype: string |
| - name: category |
| dtype: string |
| - name: detailed_category |
| dtype: string |
| - name: contains_domain_knowledge |
| dtype: bool |
| - name: db |
| dtype: string |
| - name: question |
| dtype: string |
| - name: sql |
| dtype: string |
| - name: tables |
| dtype: string |
| - name: join_keys |
| dtype: string |
| - name: column_mapping |
| dtype: string |
| - name: domain_knowledge |
| dtype: string |
| - name: sub_questions |
| dtype: string |
| - name: sub_sqls |
| dtype: string |
| splits: |
| - name: dw |
| num_bytes: 29632309 |
| num_examples: 5787 |
| - name: nova |
| num_bytes: 4728511 |
| num_examples: 1053 |
| - name: neutron |
| num_bytes: 4656231 |
| num_examples: 1017 |
| - name: dw_real |
| num_bytes: 306012 |
| num_examples: 121 |
| download_size: 8347129 |
| dataset_size: 39323063 |
| configs: |
| - config_name: default |
| data_files: |
| - split: dw |
| path: data/dw-* |
| - split: nova |
| path: data/nova-* |
| - split: neutron |
| path: data/neutron-* |
| - split: dw_real |
| path: data/dw_real-* |
| license: mit |
| --- |
| |
|
|
|
|
| # Dataset Card for `beaver-query` |
|
|
| [Homepage and leaderboard](https://beaverbench.github.io) | |
| [Github repository](https://github.com/beaverbench/beaver) | |
| [Paper](https://arxiv.org/abs/2409.02038) |
|
|
| Beaver is a holistic framework for evaluating performance on complex, private‑enterprise text‑to‑SQL tasks. |
| This repository includes questions and corresponding annotations. We reserve a portion of the full question set as a private, hidden test set. |
| Each sample contains: |
| * **id**: ID of the question |
| * **category**: one of `real`, `complex query`, `domain-specific query`, `domain-specific complex query`. |
| * `real` indicates the query originates from actual query logs. All other categories refer to queries synthesized from templates derived from real queries. |
| * `complex query`: queries with high structural complexity (e.g., many joins, nesting) but no domain-specific knowledge |
| * `domain-specific query`: queries with low structural complexity but requiring domain-specific knowledge |
| * `domain-specific complex query`: queries with both high complexity and domain knowledge |
| * **detailed_category**: one of `real`, `base`, `cte`, `nested`, `cte-nested`, `nested-cte`. A `base` query is not treated as a `complex query`, while a `cte`, `nested`, `cte-nested`, `nested-cte` query is considered a `complex query`. |
| * `real` indicates the query originates from actual query logs. All other categories refer to queries synthesized from templates derived from real queries. |
| * `base` indicates queries synthesized from base templates |
| * `cte` indicates queries synthesized from Common-Table-Expression (CTE) templates |
| * `nested` indicates queries synthesized from nesting templates |
| * `cte-nested` indicates queries synthesized from nesting templates, followed by CTE templates |
| * `nested-cte` indicates queries synthesized from CTE templates, followed by nesting templates |
| * **contains_domain_knowledge**: whether the question includes domain knowledge |
| * **db**: the ID of the referenced database |
| * **question**: the natural language question user query |
| * **sql**: the SQL statement whose execution answers the question |
| * **tables**: the tables used in the SQL statement |
| * **join_keys**: the join keys used in the SQL statement |
| * **column_mapping**: mappings from phrases in the question to specific table columns |
| * **domain_knowledge**: domain‑specific formatting rules or predicate logic |
| * **sub_questions**: a decomposition of the question into multiple sub-steps |
| * **sub_sqls**: the SQL statements corresponding to each sub‑step |
|
|
| ## Getting started |
| ``` |
| from datasets import load_dataset |
| import json |
| |
| domain = 'dw' |
| data = load_dataset('beaverbench/beaver-query') |
| json_fields = ['tables', 'join_keys', 'column_mapping', 'domain_knowledge', 'sub_questions', 'sub_sqls'] |
| for sample in data[domain]: |
| sample = {k: (json.loads(v) if k in json_fields else v) for k, v in sample.items()} |
| # print(json.dumps(sample, indent=2)) |
| ``` |
|
|
| ## Citation |
| ``` |
| @article{chen2024beaver, |
| title={BEAVER: an enterprise benchmark for text-to-sql}, |
| author={Chen, Peter Baile and Yang, Devin and Li, Weiyue and Wenz, Fabian and Zhang, Yi and Tatbul, Nesime and Cafarella, Michael and Demiralp, {\c{C}}a{\u{g}}atay and Stonebraker, Michael}, |
| journal={arXiv preprint arXiv:2409.02038}, |
| year={2024} |
| } |
| ``` |