From 2272764864555f26095563937e06a3389d42d789 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 19 Nov 2022 15:50:35 +0100 Subject: Adding upstream version 10.0.8. Signed-off-by: Daniel Baumann --- tests/test_optimizer.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/test_optimizer.py') diff --git a/tests/test_optimizer.py b/tests/test_optimizer.py index a1b7e70..6637a1d 100644 --- a/tests/test_optimizer.py +++ b/tests/test_optimizer.py @@ -29,6 +29,7 @@ class TestOptimizer(unittest.TestCase): CREATE TABLE x (a INT, b INT); CREATE TABLE y (b INT, c INT); CREATE TABLE z (b INT, c INT); + CREATE TABLE w (d TEXT, e TEXT); INSERT INTO x VALUES (1, 1); INSERT INTO x VALUES (2, 2); @@ -47,6 +48,8 @@ class TestOptimizer(unittest.TestCase): INSERT INTO y VALUES (4, 4); INSERT INTO y VALUES (5, 5); INSERT INTO y VALUES (null, null); + + INSERT INTO w VALUES ('a', 'b'); """ ) @@ -64,6 +67,10 @@ class TestOptimizer(unittest.TestCase): "b": "INT", "c": "INT", }, + "w": { + "d": "TEXT", + "e": "TEXT", + }, } def check_file(self, file, func, pretty=False, execute=False, **kwargs): @@ -224,6 +231,18 @@ class TestOptimizer(unittest.TestCase): def test_eliminate_subqueries(self): self.check_file("eliminate_subqueries", optimizer.eliminate_subqueries.eliminate_subqueries) + def test_canonicalize(self): + optimize = partial( + optimizer.optimize, + rules=[ + optimizer.qualify_tables.qualify_tables, + optimizer.qualify_columns.qualify_columns, + annotate_types, + optimizer.canonicalize.canonicalize, + ], + ) + self.check_file("canonicalize", optimize, schema=self.schema) + def test_tpch(self): self.check_file("tpc-h/tpc-h", optimizer.optimize, schema=TPCH_SCHEMA, pretty=True) -- cgit v1.2.3