1
0
Fork 0

Merging upstream version 17.2.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 20:43:05 +01:00
parent 06c5965633
commit ff2afd7448
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
91 changed files with 42856 additions and 42624 deletions

View file

@ -1,3 +1,4 @@
import time
import unittest
from unittest.mock import patch
@ -67,7 +68,7 @@ class TestParser(unittest.TestCase):
},
]
with self.assertRaises(ParseError) as ctx:
parse_one("SELECT 1;", "sqlite", [exp.From, exp.Join])
parse_one("SELECT 1;", "sqlite", into=[exp.From, exp.Join])
self.assertEqual(str(ctx.exception), expected_message)
self.assertEqual(ctx.exception.errors, expected_errors)
@ -318,6 +319,7 @@ class TestParser(unittest.TestCase):
self.assertIsInstance(parse_one("TIMESTAMP()"), exp.Func)
self.assertIsInstance(parse_one("map.x"), exp.Column)
self.assertIsInstance(parse_one("CAST(x AS CHAR(5))").to.expressions[0], exp.DataTypeSize)
self.assertEqual(parse_one("1::int64", dialect="bigquery"), parse_one("CAST(1 AS BIGINT)"))
def test_set_expression(self):
set_ = parse_one("SET")
@ -522,6 +524,55 @@ class TestParser(unittest.TestCase):
columns = expr.args["from"].this.args["pivots"][0].args["columns"]
self.assertEqual(expected_columns, [col.sql(dialect=dialect) for col in columns])
def test_parse_nested(self):
now = time.time()
query = parse_one(
"""
select *
FROM a
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
LEFT JOIN b ON a.id = b.id
"""
)
self.assertIsNotNone(query)
self.assertLessEqual(time.time() - now, 0.1)
def test_parse_properties(self):
self.assertEqual(
parse_one("create materialized table x").sql(), "CREATE MATERIALIZED TABLE x"