You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
('SELECT a, AVG(b) FROM x GROUP BY a ORDER BY AVG(b)', ["a", "_col_1"], [("b", 22.5), ("a", 25), ("c", 28)]), # PASS
('SELECT a FROM x GROUP BY a ORDER BY AVG(b)', ["a"], [("b",), ("a",), ("c",)]), # FAILED
if avg not in select clause , i have the same issue.
Here is the error log.
Traceback (most recent call last):
File "/Users/.../python3.11/site-packages/sqlglot/executor/python.py", line 46, in execute
contexts[node] = self.sort(node, context)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/.../python3.11/site-packages/sqlglot/executor/python.py", line 323, in sort
sort_ctx.sort(self.generate_tuple(step.key))
File "/Users/.../python3.11/site-packages/sqlglot/executor/context.py", line 81, in sort
self.table.rows.sort(key=sort_key)
File "/Users/.../python3.11/site-packages/sqlglot/executor/context.py", line 79, in sort_key
return self.eval_tuple(key)
^^^^^^^^^^^^^^^^^^^^
File "/Users/.../python3.11/site-packages/sqlglot/executor/context.py", line 38, in eval_tuple
return tuple(self.eval(code) for code in codes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/.../python3.11/site-packages/sqlglot/executor/context.py", line 38, in <genexpr>
return tuple(self.eval(code) for code in codes)
^^^^^^^^^^^^^^^
File "/Users/.../python3.11/site-packages/sqlglot/executor/context.py", line 35, in eval
return eval(code, self.env)
^^^^^^^^^^^^^^^^^^^^
File "ORDERED(AVG(scope["x"]["b"]), False, True)", line 1, in <module>
File "/Users/.../python3.11/site-packages/sqlglot/executor/table.py", line 104, in __getitem__
return self.row[self.columns[column]]
~~~~~~~~~~~~^^^^^^^^
KeyError: 'b'
The text was updated successfully, but these errors were encountered:
sqlglot==16.6.0
Related to #1822
if avg not in select clause , i have the same issue.
Here is the error log.
The text was updated successfully, but these errors were encountered: