From 7457677bc603569692329e39a59ccb018306e2a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 12 Mar 2023 11:17:16 +0100 Subject: Merging upstream version 11.3.6. Signed-off-by: Daniel Baumann --- tests/dialects/test_drill.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/dialects/test_drill.py') diff --git a/tests/dialects/test_drill.py b/tests/dialects/test_drill.py index a196013..e41bd34 100644 --- a/tests/dialects/test_drill.py +++ b/tests/dialects/test_drill.py @@ -51,3 +51,16 @@ class TestDrill(Validator): "drill": "SELECT * FROM table(dfs.`test_data.xlsx`(type => 'excel', sheetName => 'secondSheet'))", }, ) + + def test_validate_pivot(self): + self.validate_all( + "SELECT * FROM (SELECT education_level, salary, marital_status, " + "EXTRACT(year FROM age(birth_date)) age FROM cp.`employee.json`) PIVOT (avg(salary) AS " + "avg_salary, avg(age) AS avg_age FOR marital_status IN ('M' married, 'S' single))", + write={ + "drill": "SELECT * FROM (SELECT education_level, salary, marital_status, " + "EXTRACT(year FROM age(birth_date)) AS age FROM cp.`employee.json`) " + "PIVOT(AVG(salary) AS avg_salary, AVG(age) AS avg_age FOR marital_status " + "IN ('M' AS married, 'S' AS single))" + }, + ) -- cgit v1.2.3