From 38e6461a8afbd7cb83709ddb998f03d40ba87755 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 23 Jan 2024 06:06:14 +0100 Subject: Merging upstream version 20.9.0. Signed-off-by: Daniel Baumann --- tests/test_parser.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/test_parser.py') diff --git a/tests/test_parser.py b/tests/test_parser.py index 6611b87..bff4f98 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -86,6 +86,15 @@ class TestParser(unittest.TestCase): self.assertIsNotNone(parse_one("date").find(exp.Column)) + def test_structs(self): + cast = parse_one("cast(x as struct)") + self.assertIsInstance(cast.to.expressions[0], exp.DataType) + self.assertEqual(cast.sql(), "CAST(x AS STRUCT)") + + cast = parse_one("cast(x as struct)") + self.assertIsInstance(cast.to.expressions[0], exp.DataType) + self.assertEqual(cast.sql(), "CAST(x AS STRUCT)") + def test_float(self): self.assertEqual(parse_one(".2"), parse_one("0.2")) @@ -772,7 +781,7 @@ class TestParser(unittest.TestCase): ) self.assertEqual(ast.find(exp.Interval).this.sql(), "'71'") - self.assertEqual(ast.find(exp.Interval).unit.assert_is(exp.Var).sql(), "days") + self.assertEqual(ast.find(exp.Interval).unit.assert_is(exp.Var).sql(), "DAYS") def test_parse_concat_ws(self): ast = parse_one("CONCAT_WS(' ', 'John', 'Doe')") -- cgit v1.2.3