--- warning: DO NOT CHANGE THIS MANUALLY, THIS IS GENERATED BY https://github.com/duckdb/community-extensions repository, check README there title: yardstick excerpt: | DuckDB Community Extensions Measure-aware SQL implementing Julian Hyde's 'Measures in SQL' paper extension: name: yardstick description: Measure-aware SQL implementing Julian Hyde's 'Measures in SQL' paper version: 0.7.0 language: C++ build: cmake license: MIT requires_toolchains: "rust" excluded_platforms: "wasm_mvp;wasm_eh;wasm_threads;linux_amd64_gcc4;windows_amd64_rtools;windows_amd64_mingw" opt_in_platforms: "osx_amd64" test_config: '{"test_env_variables":{"YARDSTICK_NATIVE_PEG":"1"}}' maintainers: - sidequery repo: github: sidequery/yardstick ref: 6b5e9ead9dd69ee1f79323407c2469d5f1619481 variegata: f19d73fa93f2601cfa81ca3ebad841dffcc5f609 docs: hello_world: | -- Create a view with measures CREATE VIEW sales_v AS SELECT year, region, SUM(amount) AS MEASURE revenue, COUNT(*) AS MEASURE order_count FROM sales; -- Query with AGGREGATE() and AT modifiers SELECT year, region, AGGREGATE(revenue) AS revenue, AGGREGATE(revenue) AT (ALL region) AS year_total, AGGREGATE(revenue) / AGGREGATE(revenue) AT (ALL region) AS pct_of_year FROM sales_v; extended_description: | `yardstick` implements Julian Hyde's "Measures in SQL" paper ([arXiv:2406.00251](https://arxiv.org/abs/2406.00251)), adding measure-aware SQL to DuckDB. Measures are aggregations that know how to re-aggregate themselves when the query context changes. This enables: **Percent of total** calculations without CTEs or window functions: ```sql SELECT region, AGGREGATE(revenue) / AGGREGATE(revenue) AT (ALL) AS pct FROM sales_v; ``` **Year-over-year comparisons** with simple syntax: ```sql SELECT year, AGGREGATE(revenue) AT (SET year = year - 1) AS prior_year FROM sales_v; ``` **AT Modifiers**: - `AT (ALL)` - Grand total across all dimensions - `AT (ALL dim)` - Total excluding specific dimension - `AT (SET dim = val)` - Fix dimension to specific value - `AT (SET dim = expr)` - Fix dimension to expression - `AT (WHERE cond)` - Pre-aggregation filter - `AT (VISIBLE)` - Use query's WHERE clause For more details, visit the [extension repository](https://github.com/sidequery/yardstick). extension_star_count: 60 extension_star_count_pretty: 60 extension_download_count: 919 extension_download_count_pretty: 919 image: '/images/community_extensions/social_preview/preview_community_extension_yardstick.png' layout: community_extension_doc --- ### Compatibility Matrix This table covers all DuckDB releases that have not reached [end-of-life](https://duckdb.org/release_calendar), including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 | | :--- | :---: | :---: | :---: | :---: | :---: | | Linux AMD64 | ❌ | ❌ | ✅ | ✅ | ✅ | | Linux ARM64 | ❌ | ❌ | ✅ | ✅ | ✅ | | macOS AMD64 | ❌ | ❌ | ✅ | ✅ | ✅ | | macOS ARM64 | ❌ | ❌ | ✅ | ✅ | ✅ | | Windows AMD64 | ❌ | ❌ | ✅ | ✅ | ✅ | | Windows ARM64 | ❌ | ❌ | ❌ | ❌ | ❌ | | WebAssembly | ❌ | ❌ | ❌ | ❌ | ❌ | ### Installing and Loading ```sql INSTALL {{ page.extension.name }} FROM community; LOAD {{ page.extension.name }}; ``` {% if page.docs.hello_world %} ### Example ```sql {{ page.docs.hello_world }}``` {% endif %} {% if page.docs.extended_description %} ### About {{ page.extension.name }} {{ page.docs.extended_description }} {% endif %} ### Added Functions | function_name | function_type | description | comment | examples | |--------------------|---------------|-------------|---------|----------| | yardstick | table | NULL | NULL | | | yardstick_combine | scalar | NULL | NULL | | | yardstick_finalize | scalar | NULL | NULL | | | yardstick_scoped | table | NULL | NULL | | | yardstick_state | scalar | NULL | NULL | | | yardstick_warning | scalar | NULL | NULL | | ### Overloaded Functions This extension does not add any function overloads. ### Added Types This extension does not add any types. ### Added Settings | name | description | input_type | scope | aliases | typed_value | |---------------------------------|---------------------------------------------------------|------------|--------|---------|-------------| | allow_parser_override_extension | Allow extensions to override the current parser. | VARCHAR | GLOBAL | [] | fallback | | temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |