diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 02:50:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 02:50:21 +0000 |
commit | da8fc943704a221b86f0f6938f4131f0dd679f82 (patch) | |
tree | bef7144499ea444319403ba8dbf68480ae3a4e39 /tests/dialects/test_bigquery.py | |
parent | Adding upstream version 23.10.0. (diff) | |
download | sqlglot-da8fc943704a221b86f0f6938f4131f0dd679f82.tar.xz sqlglot-da8fc943704a221b86f0f6938f4131f0dd679f82.zip |
Adding upstream version 23.12.1.upstream/23.12.1
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 | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/dialects/test_bigquery.py b/tests/dialects/test_bigquery.py index 300d492..301cd57 100644 --- a/tests/dialects/test_bigquery.py +++ b/tests/dialects/test_bigquery.py @@ -20,6 +20,27 @@ class TestBigQuery(Validator): maxDiff = None def test_bigquery(self): + self.validate_identity( + "[a, a(1, 2,3,4444444444444444, tttttaoeunthaoentuhaoentuheoantu, toheuntaoheutnahoeunteoahuntaoeh), b(3, 4,5), c, d, tttttttttttttttteeeeeeeeeeeeeett, 12312312312]", + """[ + a, + a( + 1, + 2, + 3, + 4444444444444444, + tttttaoeunthaoentuhaoentuheoantu, + toheuntaoheutnahoeunteoahuntaoeh + ), + b(3, 4, 5), + c, + d, + tttttttttttttttteeeeeeeeeeeeeett, + 12312312312 +]""", + pretty=True, + ) + self.validate_all( "SELECT STRUCT(1, 2, 3), STRUCT(), STRUCT('abc'), STRUCT(1, t.str_col), STRUCT(1 as a, 'abc' AS b), STRUCT(str_col AS abc)", write={ @@ -40,6 +61,10 @@ class TestBigQuery(Validator): "duckdb": "STRPTIME(x, '%Y-%m-%dT%H:%M:%S.%f%z')", }, ) + self.validate_identity( + "PARSE_TIMESTAMP('%Y-%m-%dT%H:%M:%E*S%z', x)", + "PARSE_TIMESTAMP('%Y-%m-%dT%H:%M:%E*S%z', x)", + ) table = parse_one("x-0._y.z", dialect="bigquery", into=exp.Table) self.assertEqual(table.catalog, "x-0") @@ -57,9 +82,13 @@ class TestBigQuery(Validator): self.assertEqual(exp.to_table("`x.y.z`", dialect="bigquery").sql("bigquery"), "`x.y.z`") self.assertEqual(exp.to_table("`x`.`y`", dialect="bigquery").sql("bigquery"), "`x`.`y`") + column = self.validate_identity("SELECT `db.t`.`c` FROM `db.t`").selects[0] + self.assertEqual(len(column.parts), 3) + select_with_quoted_udf = self.validate_identity("SELECT `p.d.UdF`(data) FROM `p.d.t`") self.assertEqual(select_with_quoted_udf.selects[0].name, "p.d.UdF") + self.validate_identity("assert.true(1 = 1)") self.validate_identity("SELECT ARRAY_TO_STRING(list, '--') AS text") self.validate_identity("SELECT jsondoc['some_key']") self.validate_identity("SELECT `p.d.UdF`(data).* FROM `p.d.t`") |