diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-16 09:41:15 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-16 09:41:15 +0000 |
commit | 358a09296d7198a4cc142f1976de8f3eb3318e58 (patch) | |
tree | 762db96c44014dc4db5e9fc7f6709c138589155e /tests/test_executor.py | |
parent | Adding upstream version 15.2.0. (diff) | |
download | sqlglot-358a09296d7198a4cc142f1976de8f3eb3318e58.tar.xz sqlglot-358a09296d7198a4cc142f1976de8f3eb3318e58.zip |
Adding upstream version 16.2.1.upstream/16.2.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_executor.py')
-rw-r--r-- | tests/test_executor.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/test_executor.py b/tests/test_executor.py index a121dea..bb01dee 100644 --- a/tests/test_executor.py +++ b/tests/test_executor.py @@ -1,6 +1,7 @@ import datetime import unittest from datetime import date +from multiprocessing import Pool import duckdb import pandas as pd @@ -76,13 +77,21 @@ class TestExecutor(unittest.TestCase): ) return expression - for i, (sql, _) in enumerate(self.sqls): - with self.subTest(f"tpch-h {i + 1}"): - a = self.cached_execute(sql) - sql = parse_one(sql).transform(to_csv).sql(pretty=True) - table = execute(sql, TPCH_SCHEMA) - b = pd.DataFrame(table.rows, columns=table.columns) - assert_frame_equal(a, b, check_dtype=False, check_index_type=False) + with Pool() as pool: + for i, table in enumerate( + pool.starmap( + execute, + ( + (parse_one(sql).transform(to_csv).sql(pretty=True), TPCH_SCHEMA) + for sql, _ in self.sqls + ), + ) + ): + with self.subTest(f"tpch-h {i + 1}"): + sql, _ = self.sqls[i] + a = self.cached_execute(sql) + b = pd.DataFrame(table.rows, columns=table.columns) + assert_frame_equal(a, b, check_dtype=False, check_index_type=False) def test_execute_callable(self): tables = { @@ -496,6 +505,7 @@ class TestExecutor(unittest.TestCase): ("SELECT 1", ["1"], [(1,)]), ("SELECT 1 + 2 AS x", ["x"], [(3,)]), ("SELECT CONCAT('a', 'b') AS x", ["x"], [("ab",)]), + ("SELECT CONCAT('a', 1) AS x", ["x"], [("a1",)]), ("SELECT 1 AS x, 2 AS y", ["x", "y"], [(1, 2)]), ("SELECT 'foo' LIMIT 1", ["foo"], [("foo",)]), ( |