summaryrefslogtreecommitdiffstats
path: root/tests/test_executor.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-04-03 07:31:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-04-03 07:31:50 +0000
commit1fb60a37d31eacbac62ddafde51b829522925694 (patch)
tree5c04a33630f7a2cd4cff248e965053f97ec3e4ac /tests/test_executor.py
parentAdding upstream version 11.4.1. (diff)
downloadsqlglot-1fb60a37d31eacbac62ddafde51b829522925694.tar.xz
sqlglot-1fb60a37d31eacbac62ddafde51b829522925694.zip
Adding upstream version 11.4.5.upstream/11.4.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_executor.py')
-rw-r--r--tests/test_executor.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_executor.py b/tests/test_executor.py
index 013ff34..c455f3a 100644
--- a/tests/test_executor.py
+++ b/tests/test_executor.py
@@ -401,6 +401,16 @@ class TestExecutor(unittest.TestCase):
],
)
+ table1_view = exp.Select().select("id", "sub_type").from_("table1").subquery()
+ select_from_sub_query = exp.Select().select("id AS id_alias", "sub_type").from_(table1_view)
+ expression = exp.Select().select("*").from_("cte1").with_("cte1", as_=select_from_sub_query)
+
+ schema = {"table1": {"id": "str", "sub_type": "str"}}
+ executed = execute(expression, tables={t: [] for t in schema}, schema=schema)
+
+ self.assertEqual(executed.rows, [])
+ self.assertEqual(executed.columns, ("id_alias", "sub_type"))
+
def test_correlated_count(self):
tables = {
"parts": [{"pnum": 0, "qoh": 1}],