summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_bigquery.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-08 07:22:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-08 07:22:12 +0000
commit243d9a15edd910136313a7a9fa7d7f24b494e169 (patch)
tree22d768ca708dc5caa8230705a9155ba1a343502b /tests/dialects/test_bigquery.py
parentAdding upstream version 11.3.0. (diff)
downloadsqlglot-243d9a15edd910136313a7a9fa7d7f24b494e169.tar.xz
sqlglot-243d9a15edd910136313a7a9fa7d7f24b494e169.zip
Adding upstream version 11.3.3.upstream/11.3.3
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.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/dialects/test_bigquery.py b/tests/dialects/test_bigquery.py
index 7b18a6a..22387da 100644
--- a/tests/dialects/test_bigquery.py
+++ b/tests/dialects/test_bigquery.py
@@ -8,6 +8,8 @@ class TestBigQuery(Validator):
def test_bigquery(self):
self.validate_identity("SELECT STRUCT<ARRAY<STRING>>(['2023-01-17'])")
self.validate_identity("SELECT * FROM q UNPIVOT(values FOR quarter IN (b, c))")
+
+ self.validate_all("LEAST(x, y)", read={"sqlite": "MIN(x, y)"})
self.validate_all(
"REGEXP_CONTAINS('foo', '.*')",
read={"bigquery": "REGEXP_CONTAINS('foo', '.*')"},
@@ -390,3 +392,18 @@ class TestBigQuery(Validator):
"bigquery": "INSERT INTO test (cola, colb) VALUES (CAST(7 AS STRING), CAST(14 AS STRING))",
},
)
+
+ def test_merge(self):
+ self.validate_all(
+ """
+ MERGE dataset.Inventory T
+ USING dataset.NewArrivals S ON FALSE
+ WHEN NOT MATCHED BY TARGET AND product LIKE '%a%'
+ THEN DELETE
+ WHEN NOT MATCHED BY SOURCE AND product LIKE '%b%'
+ THEN DELETE""",
+ write={
+ "bigquery": "MERGE INTO dataset.Inventory AS T USING dataset.NewArrivals AS S ON FALSE WHEN NOT MATCHED AND product LIKE '%a%' THEN DELETE WHEN NOT MATCHED BY SOURCE AND product LIKE '%b%' THEN DELETE",
+ "snowflake": "MERGE INTO dataset.Inventory AS T USING dataset.NewArrivals AS S ON FALSE WHEN NOT MATCHED AND product LIKE '%a%' THEN DELETE WHEN NOT MATCHED AND product LIKE '%b%' THEN DELETE",
+ },
+ )