Merging upstream version 18.2.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
985db29269
commit
53cf4a81a6
124 changed files with 60313 additions and 50346 deletions
|
@ -216,6 +216,9 @@ class TestParser(unittest.TestCase):
|
|||
with self.assertRaises(ParseError):
|
||||
parse_one("IF(a > 0)")
|
||||
|
||||
with self.assertRaises(ParseError):
|
||||
parse_one("SELECT CASE FROM x")
|
||||
|
||||
with self.assertRaises(ParseError):
|
||||
parse_one("WITH cte AS (SELECT * FROM x)")
|
||||
|
||||
|
@ -435,7 +438,7 @@ class TestParser(unittest.TestCase):
|
|||
self.assertIsInstance(parse_one("TIMESTAMP('2022-01-01')"), exp.Func)
|
||||
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.assertIsInstance(parse_one("CAST(x AS CHAR(5))").to.expressions[0], exp.DataTypeParam)
|
||||
self.assertEqual(parse_one("1::int64", dialect="bigquery"), parse_one("CAST(1 AS BIGINT)"))
|
||||
|
||||
def test_set_expression(self):
|
||||
|
@ -708,3 +711,11 @@ class TestParser(unittest.TestCase):
|
|||
parse_one("SELECT a, b ?? c ?? 'No Data' FROM z").sql(),
|
||||
"SELECT a, COALESCE(COALESCE(b, c), 'No Data') FROM z",
|
||||
)
|
||||
|
||||
def test_parse_intervals(self):
|
||||
ast = parse_one(
|
||||
"SELECT a FROM tbl WHERE a <= DATE '1998-12-01' - INTERVAL '71 days' GROUP BY b"
|
||||
)
|
||||
|
||||
self.assertEqual(ast.find(exp.Interval).this.sql(), "'71'")
|
||||
self.assertEqual(ast.find(exp.Interval).unit.assert_is(exp.Var).sql(), "days")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue