diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-01-17 10:32:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-01-17 10:32:16 +0000 |
commit | d3bb537b2b73788ba06bf4158f473ecc5bb556cc (patch) | |
tree | 6c1b280de128c7bf77baaa258560a1f39a4e15c7 /tests/test_optimizer.py | |
parent | Releasing debian version 10.4.2-1. (diff) | |
download | sqlglot-d3bb537b2b73788ba06bf4158f473ecc5bb556cc.tar.xz sqlglot-d3bb537b2b73788ba06bf4158f473ecc5bb556cc.zip |
Merging upstream version 10.5.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/test_optimizer.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/test_optimizer.py b/tests/test_optimizer.py index 1c97be7..887f427 100644 --- a/tests/test_optimizer.py +++ b/tests/test_optimizer.py @@ -299,10 +299,10 @@ FROM READ_CSV('tests/fixtures/optimizer/tpc-h/nation.csv.gz', 'delimiter', '|') self.assertEqual(set(scopes[6].sources), {"q", "z", "r", "s"}) self.assertEqual(len(scopes[6].columns), 6) - self.assertEqual(set(c.table for c in scopes[6].columns), {"r", "s"}) + self.assertEqual({c.table for c in scopes[6].columns}, {"r", "s"}) self.assertEqual(scopes[6].source_columns("q"), []) self.assertEqual(len(scopes[6].source_columns("r")), 2) - self.assertEqual(set(c.table for c in scopes[6].source_columns("r")), {"r"}) + self.assertEqual({c.table for c in scopes[6].source_columns("r")}, {"r"}) self.assertEqual({c.sql() for c in scopes[-1].find_all(exp.Column)}, {"r.b", "s.b"}) self.assertEqual(scopes[-1].find(exp.Column).sql(), "r.b") @@ -578,3 +578,16 @@ FROM READ_CSV('tests/fixtures/optimizer/tpc-h/nation.csv.gz', 'delimiter', '|') scope_t, scope_y = build_scope(query).cte_scopes self.assertEqual(set(scope_t.cte_sources), {"t"}) self.assertEqual(set(scope_y.cte_sources), {"t", "y"}) + + def test_schema_with_spaces(self): + schema = { + "a": { + "b c": "text", + '"d e"': "text", + } + } + + self.assertEqual( + optimizer.optimize(parse_one("SELECT * FROM a"), schema=schema), + parse_one('SELECT "a"."b c" AS "b c", "a"."d e" AS "d e" FROM "a" AS "a"'), + ) |