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: datafusion/sqllogictest/test_files/pivot.slt
+14-1Lines changed: 14 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,19 @@ ORDER BY empid;
68
68
2 39500 90700
69
69
3 1001 1001
70
70
71
+
# PIVOT with cast to pivot column type
72
+
query TIII
73
+
SELECT *
74
+
FROM quarterly_sales
75
+
PIVOT(SUM(amount) FOR empid IN (1,2,3))
76
+
ORDER BY quarter;
77
+
----
78
+
2023_Q1 10400 39500 NULL
79
+
2023_Q2 8000 90700 NULL
80
+
2023_Q3 11000 12000 2700
81
+
2023_Q4 18000 5300 28900
82
+
83
+
71
84
# PIVOT with automatic detection of all distinct column values using ANY
72
85
query TIII
73
86
SELECT *
@@ -119,7 +132,7 @@ ORDER BY empid;
119
132
120
133
121
134
# Non-existent column in the FOR clause
122
-
query error DataFusion error: Schema error: No field named non_existent_column\. Valid fields are quarterly_sales\.empid, quarterly_sales\.amount, quarterly_sales\.quarter\.
135
+
query error DataFusion error: Error during planning: Pivot column 'non_existent_column' does not exist in input schema
123
136
SELECT *
124
137
FROM quarterly_sales
125
138
PIVOT(SUM(amount) FOR non_existent_column IN ('2023_Q1', '2023_Q2'))
0 commit comments