diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-26 17:21:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-26 17:21:50 +0000 |
commit | 6c774776db5e016d597e582c7006ba8d27006f9d (patch) | |
tree | 8a65b7a9938002f9b152d9a6dfd150f15e402a6b /tests/dialects/test_bigquery.py | |
parent | Adding upstream version 18.13.0. (diff) | |
download | sqlglot-6c774776db5e016d597e582c7006ba8d27006f9d.tar.xz sqlglot-6c774776db5e016d597e582c7006ba8d27006f9d.zip |
Adding upstream version 18.17.0.upstream/18.17.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_bigquery.py')
-rw-r--r-- | tests/dialects/test_bigquery.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/dialects/test_bigquery.py b/tests/dialects/test_bigquery.py index 3cf95a7..3601e47 100644 --- a/tests/dialects/test_bigquery.py +++ b/tests/dialects/test_bigquery.py @@ -9,6 +9,10 @@ class TestBigQuery(Validator): maxDiff = None def test_bigquery(self): + self.validate_identity("CREATE SCHEMA x DEFAULT COLLATE 'en'") + self.validate_identity("CREATE TABLE x (y INT64) DEFAULT COLLATE 'en'") + self.validate_identity("PARSE_JSON('{}', wide_number_mode => 'exact')") + with self.assertRaises(TokenError): transpile("'\\'", read="bigquery") @@ -139,6 +143,20 @@ class TestBigQuery(Validator): self.validate_all("x <> ''''''", write={"bigquery": "x <> ''"}) self.validate_all("CAST(x AS DATETIME)", read={"": "x::timestamp"}) self.validate_all( + "SELECT * FROM t WHERE EXISTS(SELECT * FROM unnest(nums) AS x WHERE x > 1)", + write={ + "bigquery": "SELECT * FROM t WHERE EXISTS(SELECT * FROM UNNEST(nums) AS x WHERE x > 1)", + "duckdb": "SELECT * FROM t WHERE EXISTS(SELECT * FROM UNNEST(nums) AS _t(x) WHERE x > 1)", + }, + ) + self.validate_all( + "NULL", + read={ + "duckdb": "NULL = a", + "postgres": "a = NULL", + }, + ) + self.validate_all( "SELECT '\\n'", read={ "bigquery": "SELECT '''\n'''", @@ -465,9 +483,8 @@ class TestBigQuery(Validator): }, write={ "bigquery": "SELECT * FROM UNNEST(['7', '14']) AS x", - "presto": "SELECT * FROM UNNEST(ARRAY['7', '14']) AS (x)", - "hive": "SELECT * FROM UNNEST(ARRAY('7', '14')) AS (x)", - "spark": "SELECT * FROM UNNEST(ARRAY('7', '14')) AS (x)", + "presto": "SELECT * FROM UNNEST(ARRAY['7', '14']) AS _t(x)", + "spark": "SELECT * FROM UNNEST(ARRAY('7', '14')) AS _t(x)", }, ) self.validate_all( |