diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-19 13:45:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-19 13:45:09 +0000 |
commit | 639a208fa57ea674d165c4837e96f3ae4d7e3e61 (patch) | |
tree | f4d66da146c396d407cecefb5b405e609af1109e /tests/dialects/test_bigquery.py | |
parent | Releasing debian version 11.0.1-1. (diff) | |
download | sqlglot-639a208fa57ea674d165c4837e96f3ae4d7e3e61.tar.xz sqlglot-639a208fa57ea674d165c4837e96f3ae4d7e3e61.zip |
Merging upstream version 11.1.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/dialects/test_bigquery.py | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/tests/dialects/test_bigquery.py b/tests/dialects/test_bigquery.py index 241f496..7b18a6a 100644 --- a/tests/dialects/test_bigquery.py +++ b/tests/dialects/test_bigquery.py @@ -36,30 +36,33 @@ class TestBigQuery(Validator): self.validate_all( r'r"""/\*.*\*/"""', write={ - "bigquery": r"'/\\*.*\\*/'", + "bigquery": r"'/\*.*\*/'", "duckdb": r"'/\*.*\*/'", "presto": r"'/\*.*\*/'", - "hive": r"'/\\*.*\\*/'", - "spark": r"'/\\*.*\\*/'", + "hive": r"'/\*.*\*/'", + "spark": r"'/\*.*\*/'", }, ) + with self.assertRaises(RuntimeError): + transpile("'\\'", read="bigquery") + self.validate_all( - r"'\\'", + "'\\\\'", write={ "bigquery": r"'\\'", - "duckdb": r"'\'", - "presto": r"'\'", + "duckdb": r"'\\'", + "presto": r"'\\'", "hive": r"'\\'", }, ) self.validate_all( - R'R"""/\*.*\*/"""', + r'R"""/\*.*\*/"""', write={ - "bigquery": R"'/\\*.*\\*/'", - "duckdb": R"'/\*.*\*/'", - "presto": R"'/\*.*\*/'", - "hive": R"'/\\*.*\\*/'", - "spark": R"'/\\*.*\\*/'", + "bigquery": r"'/\*.*\*/'", + "duckdb": r"'/\*.*\*/'", + "presto": r"'/\*.*\*/'", + "hive": r"'/\*.*\*/'", + "spark": r"'/\*.*\*/'", }, ) self.validate_all( @@ -228,6 +231,12 @@ class TestBigQuery(Validator): }, ) self.validate_all( + "CREATE TABLE db.example_table (x int) PARTITION BY x cluster by x", + write={ + "bigquery": "CREATE TABLE db.example_table (x INT64) PARTITION BY x CLUSTER BY x", + }, + ) + self.validate_all( "SELECT * FROM a WHERE b IN UNNEST([1, 2, 3])", write={ "bigquery": "SELECT * FROM a WHERE b IN UNNEST([1, 2, 3])", @@ -324,6 +333,12 @@ class TestBigQuery(Validator): "bigquery": "SELECT * FROM (SELECT a, b, c FROM test) PIVOT(SUM(b) AS d, COUNT(*) AS e FOR c IN ('x', 'y'))", }, ) + self.validate_all( + "SELECT REGEXP_EXTRACT(abc, 'pattern(group)') FROM table", + write={ + "duckdb": "SELECT REGEXP_EXTRACT(abc, 'pattern(group)', 1) FROM table", + }, + ) self.validate_identity("BEGIN A B C D E F") self.validate_identity("BEGIN TRANSACTION") self.validate_identity("COMMIT TRANSACTION") |