Adding upstream version 10.5.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
63044b3f6c
commit
b97d49f611
58 changed files with 1480 additions and 383 deletions
|
@ -8,7 +8,8 @@ from tests.helpers import assert_logger_contains
|
|||
|
||||
class TestParser(unittest.TestCase):
|
||||
def test_parse_empty(self):
|
||||
self.assertIsNone(parse_one(""))
|
||||
with self.assertRaises(ParseError) as ctx:
|
||||
parse_one("")
|
||||
|
||||
def test_parse_into(self):
|
||||
self.assertIsInstance(parse_one("left join foo", into=exp.Join), exp.Join)
|
||||
|
@ -90,6 +91,9 @@ class TestParser(unittest.TestCase):
|
|||
parse_one("""SELECT * FROM x CROSS JOIN y, z LATERAL VIEW EXPLODE(y)""").sql(),
|
||||
"""SELECT * FROM x, z CROSS JOIN y LATERAL VIEW EXPLODE(y)""",
|
||||
)
|
||||
self.assertIsNone(
|
||||
parse_one("create table a as (select b from c) index").find(exp.TableAlias)
|
||||
)
|
||||
|
||||
def test_command(self):
|
||||
expressions = parse("SET x = 1; ADD JAR s3://a; SELECT 1", read="hive")
|
||||
|
@ -155,6 +159,11 @@ class TestParser(unittest.TestCase):
|
|||
assert expressions[0].args["from"].expressions[0].this.name == "a"
|
||||
assert expressions[1].args["from"].expressions[0].this.name == "b"
|
||||
|
||||
expressions = parse("SELECT 1; ; SELECT 2")
|
||||
|
||||
assert len(expressions) == 3
|
||||
assert expressions[1] is None
|
||||
|
||||
def test_expression(self):
|
||||
ignore = Parser(error_level=ErrorLevel.IGNORE)
|
||||
self.assertIsInstance(ignore.expression(exp.Hint, expressions=[""]), exp.Hint)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue