diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-12 10:17:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-12 10:17:12 +0000 |
commit | e53bec16fb5ba08b2ff8daf3ffe5467a7c24b757 (patch) | |
tree | c13a841e8033707ca74d492bac3ebfc5bd9dd393 /tests/dialects/test_drill.py | |
parent | Adding upstream version 11.3.3. (diff) | |
download | sqlglot-e53bec16fb5ba08b2ff8daf3ffe5467a7c24b757.tar.xz sqlglot-e53bec16fb5ba08b2ff8daf3ffe5467a7c24b757.zip |
Adding upstream version 11.3.6.upstream/11.3.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_drill.py')
-rw-r--r-- | tests/dialects/test_drill.py | 13 |
1 files changed, 13 insertions, 0 deletions
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))" + }, + ) |