grundprinzip commented on code in PR #38768:
URL: https://github.com/apache/spark/pull/38768#discussion_r1031157012
##########
python/pyspark/sql/connect/dataframe.py:
##########
@@ -51,24 +52,11 @@
class GroupingFrame(object):
-
- MeasuresType = Union[Sequence[Tuple["ExpressionOrString", str]], Dict[str,
str]]
- OptMeasuresType = Optional[MeasuresType]
-
def __init__(self, df: "DataFrame", *grouping_cols: Union[Column, str]) ->
None:
self._df = df
self._grouping_cols = [x if isinstance(x, Column) else df[x] for x in
grouping_cols]
- def agg(self, exprs: Optional[MeasuresType] = None) -> "DataFrame":
-
- # Normalize the dictionary into a list of tuples.
- if isinstance(exprs, Dict):
- measures = list(exprs.items())
- elif isinstance(exprs, List):
- measures = exprs
- else:
- measures = []
-
+ def agg(self, measures: Sequence[Expression]) -> "DataFrame":
res = DataFrame.withPlan(
Review Comment:
In OSS we have an assert here
```
>>> df.groupBy("state").agg()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/martin.grund/Development/spark/python/pyspark/sql/group.py",
line 162, in agg
assert exprs, "exprs should not be empty"
AssertionError: exprs should not be empty
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]