Merging upstream version 26.19.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
58527c3d26
commit
a99682f526
98 changed files with 67345 additions and 65319 deletions
|
@ -891,7 +891,17 @@ FROM READ_CSV('tests/fixtures/optimizer/tpc-h/nation.csv.gz', 'delimiter', '|')
|
|||
|
||||
def test_annotate_funcs(self):
|
||||
test_schema = {
|
||||
"tbl": {"bin_col": "BINARY", "str_col": "STRING", "bignum_col": "BIGNUMERIC"}
|
||||
"tbl": {
|
||||
"bin_col": "BINARY",
|
||||
"str_col": "STRING",
|
||||
"bignum_col": "BIGNUMERIC",
|
||||
"date_col": "DATE",
|
||||
"timestamp_col": "TIMESTAMP",
|
||||
"double_col": "DOUBLE",
|
||||
"bigint_col": "BIGINT",
|
||||
"bool_col": "BOOLEAN",
|
||||
"interval_col": "INTERVAL",
|
||||
}
|
||||
}
|
||||
|
||||
for i, (meta, sql, expected) in enumerate(
|
||||
|
@ -1552,3 +1562,19 @@ FROM READ_CSV('tests/fixtures/optimizer/tpc-h/nation.csv.gz', 'delimiter', '|')
|
|||
self.assertEqual(4, normalization_distance(gen_expr(2), max_=100))
|
||||
self.assertEqual(18, normalization_distance(gen_expr(3), max_=100))
|
||||
self.assertEqual(110, normalization_distance(gen_expr(10), max_=100))
|
||||
|
||||
def test_manually_annotate_snowflake(self):
|
||||
dialect = "snowflake"
|
||||
schema = {
|
||||
"SCHEMA": {
|
||||
"TBL": {"COL": "INT", "col2": "VARCHAR"},
|
||||
}
|
||||
}
|
||||
example_query = 'SELECT * FROM "SCHEMA"."TBL"'
|
||||
|
||||
expression = parse_one(example_query, dialect=dialect)
|
||||
qual = optimizer.qualify.qualify(expression, schema=schema, dialect=dialect)
|
||||
annotated = optimizer.annotate_types.annotate_types(qual, schema=schema, dialect=dialect)
|
||||
|
||||
self.assertTrue(annotated.selects[0].is_type("INT"))
|
||||
self.assertTrue(annotated.selects[1].is_type("VARCHAR"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue