diff options
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") |