summaryrefslogtreecommitdiffstats
path: root/tests/test_executor.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_executor.py')
-rw-r--r--tests/test_executor.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_executor.py b/tests/test_executor.py
index 317b930..e80fb1e 100644
--- a/tests/test_executor.py
+++ b/tests/test_executor.py
@@ -14,6 +14,8 @@ from sqlglot.errors import ExecuteError
from sqlglot.executor import execute
from sqlglot.executor.python import Python
from sqlglot.executor.table import Table, ensure_tables
+from sqlglot.optimizer import optimize
+from sqlglot.planner import Plan
from tests.helpers import (
FIXTURES_DIR,
SKIP_INTEGRATION,
@@ -862,3 +864,18 @@ class TestExecutor(unittest.TestCase):
result = execute("SELECT x FROM t", dialect="duckdb", tables=tables)
self.assertEqual(result.columns, ("x",))
self.assertEqual(result.rows, [([1, 2, 3],)])
+
+ def test_agg_order(self):
+ plan = Plan(
+ optimize("""
+ SELECT
+ AVG(bill_length_mm) AS avg_bill_length,
+ AVG(bill_depth_mm) AS avg_bill_depth
+ FROM penguins
+ """)
+ )
+
+ assert [agg.alias for agg in plan.root.aggregations] == [
+ "avg_bill_length",
+ "avg_bill_depth",
+ ]