Skip to content

Commit

Permalink
Merge pull request #681 from mabel-dev/FIX/#518
Browse files Browse the repository at this point in the history
  • Loading branch information
joocer authored Nov 23, 2022
2 parents d75c1e5 + 9ab2d5f commit 8b634c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions opteryx/operators/aggregate_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ def __init__(self, properties: QueryProperties, **config):
super().__init__(properties=properties)

self._aggregates = config.get("aggregates", [])
if any(node.token_type == NodeType.WILDCARD for node in self._aggregates):
raise SqlError("Cannot select `*` with `GROUP BY` clause.")

self._groups = []
for group in config.get("groups", []):
Expand Down
2 changes: 2 additions & 0 deletions tests/sql_battery/test_shapes_and_errors_battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,8 @@
("SELECT * FROM $planets WHERE 1 = 1 FOR TODAY;", None, None, SqlError),
("SELECT * FROM $planets GROUP BY name FOR TODAY;", None, None, SqlError),
("SELECT * FROM $planets AS P FOR TODAY;", None, None, SqlError),
# [#518] SELECT * and GROUP BY can't be used together
("SELECT * FROM $planets GROUP BY name", None, None, SqlError),
]
# fmt:on

Expand Down

0 comments on commit 8b634c1

Please sign in to comment.