You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-15Lines changed: 7 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,8 +52,7 @@ SELECT
52
52
FROM sales;
53
53
54
54
-- Query with AGGREGATE() and AT modifiers
55
-
-- SEMANTIC is required for AGGREGATE() without AT, optional for AT queries
56
-
SEMANTIC SELECT
55
+
SELECT
57
56
year,
58
57
region,
59
58
AGGREGATE(revenue) AS revenue,
@@ -62,15 +61,15 @@ SEMANTIC SELECT
62
61
FROM sales_v;
63
62
64
63
-- Variance from the global average
65
-
SEMANTIC SELECT
64
+
SELECT
66
65
region,
67
66
AGGREGATE(revenue) AS revenue,
68
67
AGGREGATE(revenue) AT (ALL) /4.0AS expected_if_equal, -- 4 regions
69
68
AGGREGATE(revenue) - (AGGREGATE(revenue) AT (ALL) /4.0) AS variance
70
69
FROM sales_v;
71
70
72
71
-- Nested percentages (% of year, and that year's % of total)
73
-
SEMANTIC SELECT
72
+
SELECT
74
73
year,
75
74
region,
76
75
AGGREGATE(revenue) AS revenue,
@@ -79,15 +78,15 @@ SEMANTIC SELECT
79
78
FROM sales_v;
80
79
81
80
-- Compare 2024 performance to 2023 baseline for each region
82
-
SEMANTIC SELECT
81
+
SELECT
83
82
region,
84
83
AGGREGATE(revenue) AT (SET year =2024) AS rev_2024,
85
84
AGGREGATE(revenue) AT (SET year =2023) AS rev_2023,
86
85
AGGREGATE(revenue) AT (SET year =2024) - AGGREGATE(revenue) AT (SET year =2023) AS growth
87
86
FROM sales_v;
88
87
89
88
-- Filter to specific segments
90
-
SEMANTIC SELECT
89
+
SELECT
91
90
year,
92
91
AGGREGATE(revenue) AS total_revenue,
93
92
AGGREGATE(revenue) AT (SET region ='North') AS north_revenue,
@@ -127,21 +126,14 @@ Yardstick automatically handles the grouping. All DuckDB aggregate functions are
127
126
128
127
### Querying Measures
129
128
130
-
Queries using `AGGREGATE()` without AT modifiers must use the `SEMANTIC` prefix. If an `AT (...)` modifier is present, the query can run without `SEMANTIC` because the AT syntax routes the statement through the extension parser.
131
-
132
129
```sql
133
-
SEMANTIC SELECT
130
+
SELECT
134
131
dimensions,
135
132
AGGREGATE(measure_name) [AT modifier]
136
133
FROM view_name;
137
134
```
138
135
139
-
```sql
140
-
SELECT
141
-
dimensions,
142
-
AGGREGATE(measure_name) AT (ALL)
143
-
FROM view_name;
144
-
```
136
+
On DuckDB 1.5+, queries containing `AGGREGATE()` are automatically intercepted by the extension's parser override, so no special prefix is needed. On older versions, the `SEMANTIC` prefix is still supported as a fallback.
0 commit comments