1
0
Fork 0

Merging upstream version 22.2.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:29:39 +01:00
parent b13ba670fd
commit 2c28c49d7e
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
148 changed files with 68457 additions and 63176 deletions

View file

@ -249,7 +249,7 @@ class TestExpressions(unittest.TestCase):
{"example.table": "`my-project.example.table`"},
dialect="bigquery",
).sql(),
'SELECT * FROM "my-project".example.table /* example.table */',
'SELECT * FROM "my-project"."example"."table" /* example.table */',
)
def test_expand(self):
@ -313,6 +313,18 @@ class TestExpressions(unittest.TestCase):
).sql(),
"SELECT * FROM (SELECT a FROM tbl1) WHERE b > 100",
)
self.assertEqual(
exp.replace_placeholders(
parse_one("select * from foo WHERE x > ? AND y IS ?"), 0, False
).sql(),
"SELECT * FROM foo WHERE x > 0 AND y IS FALSE",
)
self.assertEqual(
exp.replace_placeholders(
parse_one("select * from foo WHERE x > :int1 AND y IS :bool1"), int1=0, bool1=False
).sql(),
"SELECT * FROM foo WHERE x > 0 AND y IS FALSE",
)
def test_function_building(self):
self.assertEqual(exp.func("max", 1).sql(), "MAX(1)")
@ -645,6 +657,7 @@ class TestExpressions(unittest.TestCase):
self.assertIsInstance(parse_one("TO_HEX(foo)", read="bigquery"), exp.Hex)
self.assertIsInstance(parse_one("TO_HEX(MD5(foo))", read="bigquery"), exp.MD5)
self.assertIsInstance(parse_one("TRANSFORM(a, b)", read="spark"), exp.Transform)
self.assertIsInstance(parse_one("ADD_MONTHS(a, b)"), exp.AddMonths)
def test_column(self):
column = parse_one("a.b.c.d")