Skip to content

Commit bfe436f

Browse files
SNOW-2268215: support group by all (#3889)
1 parent b0f4438 commit bfe436f

File tree

10 files changed

+437
-244
lines changed

10 files changed

+437
-244
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#### New Features
88

99
- Added a new function `service` in `snowflake.snowpark.functions` that allows users to create a callable representing a Snowpark Container Services (SPCS) service.
10+
- Added a new function `group_by_all()` to the `DataFrame` class.
1011
- Added `connection_parameters` parameter to `DataFrameReader.dbapi()` (PuPr) method to allow passing keyword arguments to the `create_connection` callable.
1112
- Added support for `Session.begin_transaction`, `Session.commit` and `Session.rollback`.
1213
- Added support for the following functions in `functions.py`:

docs/source/snowpark/dataframe.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ DataFrame
5757
DataFrame.flatten
5858
DataFrame.groupBy
5959
DataFrame.group_by
60+
DataFrame.group_by_all
6061
DataFrame.group_by_grouping_sets
6162
DataFrame.intersect
6263
DataFrame.join

src/snowflake/snowpark/_internal/analyzer/analyzer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
from snowflake.snowpark._internal.analyzer.grouping_set import (
9292
GroupingSet,
9393
GroupingSetsExpression,
94+
GroupByAll,
9495
)
9596
from snowflake.snowpark._internal.analyzer.select_statement import (
9697
Selectable,
@@ -346,6 +347,8 @@ def analyze(
346347
)
347348

348349
if isinstance(expr, GroupingSet):
350+
if isinstance(expr, GroupByAll):
351+
return "ALL"
349352
return self.grouping_extractor(expr, df_aliased_col_name_to_real_col_name)
350353

351354
if isinstance(expr, WindowExpression):

src/snowflake/snowpark/_internal/analyzer/grouping_set.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ class Rollup(GroupingSet):
4040
pass
4141

4242

43+
class GroupByAll(GroupingSet):
44+
pass
45+
46+
4347
class GroupingSetsExpression(Expression):
4448
def __init__(self, args: List[List[Expression]]) -> None:
4549
super().__init__()

0 commit comments

Comments
 (0)