diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-08 07:22:15 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-08 07:22:15 +0000 |
commit | 5b1ac5070c43c40a2b5bbc991198b0dddf45dc75 (patch) | |
tree | ed329138d5e8e5c9d5164b5c853d6f40a116f4d6 /tests/dialects/test_bigquery.py | |
parent | Releasing debian version 11.3.0-1. (diff) | |
download | sqlglot-5b1ac5070c43c40a2b5bbc991198b0dddf45dc75.tar.xz sqlglot-5b1ac5070c43c40a2b5bbc991198b0dddf45dc75.zip |
Merging upstream version 11.3.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/dialects/test_bigquery.py | 17 |
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", + }, + ) |