Skip to content

Commit f7d1760

Browse files
authored
Fix GROUP BY spacing in semantic expansion (#16)
* Fix AGGREGATE expansion in CTEs * Fix CI compile error * Handle spacing in GROUP BY parsing * Handle GROUP BY spacing
1 parent ca87bf9 commit f7d1760

File tree

2 files changed

+284
-44
lines changed

2 files changed

+284
-44
lines changed

test/sql/measures.test

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,36 @@ SEMANTIC SELECT year, region, AGGREGATE(revenue) FROM sales_v;
3434
2023 EU 75.0
3535
2023 US 150.0
3636

37+
# =============================================================================
38+
# Test: CTE with AGGREGATE
39+
# =============================================================================
40+
41+
query IIR rowsort
42+
SEMANTIC WITH a AS (
43+
SELECT year, region, AGGREGATE(revenue) AS revenue
44+
FROM sales_v
45+
)
46+
SELECT * FROM a;
47+
----
48+
2022 EU 50.0
49+
2022 US 100.0
50+
2023 EU 75.0
51+
2023 US 150.0
52+
53+
# =============================================================================
54+
# Test: GROUP BY with extra spaces
55+
# =============================================================================
56+
57+
query IIR rowsort
58+
SEMANTIC SELECT year, region, AGGREGATE(revenue) AT (ALL region) AS year_total
59+
FROM sales_v
60+
GROUP BY year, region;
61+
----
62+
2022 EU 150.0
63+
2022 US 150.0
64+
2023 EU 225.0
65+
2023 US 225.0
66+
3767
# =============================================================================
3868
# Test: AT (ALL dimension) - remove dimension from context
3969
# =============================================================================

0 commit comments

Comments
 (0)