Merging upstream version 18.7.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
77523b6777
commit
d1b976f442
96 changed files with 59037 additions and 52828 deletions
|
@ -679,7 +679,7 @@ FROM READ_CSV('tests/fixtures/optimizer/tpc-h/nation.csv.gz', 'delimiter', '|')
|
|||
|
||||
def test_unknown_annotation(self):
|
||||
schema = {"x": {"cola": "VARCHAR"}}
|
||||
sql = "SELECT x.cola || SOME_ANONYMOUS_FUNC(x.cola) AS col FROM x AS x"
|
||||
sql = "SELECT x.cola + SOME_ANONYMOUS_FUNC(x.cola) AS col FROM x AS x"
|
||||
|
||||
concat_expr_alias = annotate_types(parse_one(sql), schema=schema).expressions[0]
|
||||
self.assertEqual(concat_expr_alias.type.this, exp.DataType.Type.UNKNOWN)
|
||||
|
@ -702,7 +702,7 @@ FROM READ_CSV('tests/fixtures/optimizer/tpc-h/nation.csv.gz', 'delimiter', '|')
|
|||
self.assertEqual(expression.right.type.this, exp.DataType.Type.INT)
|
||||
|
||||
# NULL <op> UNKNOWN should yield NULL
|
||||
sql = "SELECT NULL || SOME_ANONYMOUS_FUNC() AS result"
|
||||
sql = "SELECT NULL + SOME_ANONYMOUS_FUNC() AS result"
|
||||
|
||||
concat_expr_alias = annotate_types(parse_one(sql)).expressions[0]
|
||||
self.assertEqual(concat_expr_alias.type.this, exp.DataType.Type.NULL)
|
||||
|
@ -776,6 +776,17 @@ FROM READ_CSV('tests/fixtures/optimizer/tpc-h/nation.csv.gz', 'delimiter', '|')
|
|||
self.assertEqual(exp.DataType.Type.ARRAY, expression.selects[0].type.this)
|
||||
self.assertEqual(expression.selects[0].type.sql(), "ARRAY<INT>")
|
||||
|
||||
def test_type_annotation_cache(self):
|
||||
sql = "SELECT 1 + 1"
|
||||
expression = annotate_types(parse_one(sql))
|
||||
|
||||
self.assertEqual(exp.DataType.Type.INT, expression.selects[0].type.this)
|
||||
|
||||
expression.selects[0].this.replace(parse_one("1.2"))
|
||||
expression = annotate_types(expression)
|
||||
|
||||
self.assertEqual(exp.DataType.Type.DOUBLE, expression.selects[0].type.this)
|
||||
|
||||
def test_user_defined_type_annotation(self):
|
||||
schema = MappingSchema({"t": {"x": "int"}}, dialect="postgres")
|
||||
expression = annotate_types(parse_one("SELECT CAST(x AS IPADDRESS) FROM t"), schema=schema)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue