Skip to content

Commit 125f581

Browse files
Merge branch 'main' into helmeleegy-SNOW-2022698
2 parents 9ce3140 + 9d0f435 commit 125f581

24 files changed

+2474
-1740
lines changed

CHANGELOG.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
- Added support for `restricted caller` permission of `execute_as` argument in `StoredProcedure.regsiter()`
1010

11+
#### Improvements
12+
13+
- Renamed the `relaxed_ordering` param into `enforce_ordering` for `DataFrame.read_snowflake`. Also the new default values is `enforce_ordering=False` which has the opposite effect of the previous default value, `relaxed_ordering=False`.
14+
15+
1116
#### Bug Fixes
1217

1318
- Fixed a bug in `DataFrame.group_by().pivot().agg` when the pivot column and aggregate column are the same.
@@ -25,9 +30,21 @@
2530

2631
### Snowpark pandas API Updates
2732

33+
#### New Features
34+
35+
- Added support for `DataFrame.create_or_replace_view` and `Series.create_or_replace_view`.
36+
- Added support for `DataFrame.create_or_replace_dynamic_table` and `Series.create_or_replace_dynamic_table`.
37+
- Added support for `DataFrame.to_view` and `Series.to_view`.
38+
- Added support for `DataFrame.to_dynamic_table` and `Series.to_dynamic_table`.
39+
2840
#### Improvements
2941

3042
- Improve performance of `DataFrame.groupby.apply` and `Series.groupby.apply` by avoiding expensive pivot step.
43+
- Renamed the `relaxed_ordering` param into `enforce_ordering` for `pd.read_snowflake`. Also the new default values is `enforce_ordering=False` which has the opposite effect of the previous default value, `relaxed_ordering=False`.
44+
45+
#### Bug Fixes
46+
47+
- Fixed a bug for `pd.read_snowflake` when reading iceberg tables and `enforce_ordering=True`.
3148

3249
## 1.30.0 (2024-03-27)
3350

@@ -73,8 +90,6 @@
7390
- Added support for list values in `Series.str.__getitem__` (`Series.str[...]`).
7491
- Added support for `pd.Grouper` objects in group by operations. When `freq` is specified, the default values of the `sort`, `closed`, `label`, and `convention` arguments are supported; `origin` is supported when it is `start` or `start_day`.
7592
- Added support for relaxed consistency and ordering guarantees in `pd.read_snowflake` for both named data sources (e.g., tables and views) and query data sources by introducing the new parameter `relaxed_ordering`.
76-
- Added support for `DataFrame.create_or_replace_view` and `Series.create_or_replace_view`.
77-
- Added support for `DataFrame.create_or_replace_dynamic_table` and `Series.create_or_replace_dynamic_table`.
7893

7994
#### Improvements
8095

docs/source/modin/dataframe.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ DataFrame
4040
DataFrame.cache_result
4141
DataFrame.create_or_replace_view
4242
DataFrame.create_or_replace_dynamic_table
43+
DataFrame.to_view
44+
DataFrame.to_dynamic_table
4345

4446
.. rubric:: Conversion
4547

docs/source/modin/series.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Series
4646
Series.cache_result
4747
Series.create_or_replace_view
4848
Series.create_or_replace_dynamic_table
49+
Series.to_view
50+
Series.to_dynamic_table
4951

5052
.. rubric:: Conversion
5153

src/snowflake/snowpark/_internal/udf_utils.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,19 @@ def create_python_udf_or_sp(
13111311
raise ValueError(
13121312
"artifact_repository must be specified when artifact_repository_packages has been specified"
13131313
)
1314+
if all_packages and artifact_repository_packages:
1315+
package_names = [
1316+
pack.strip("\"'").split("==")[0] for pack in all_packages.split(",")
1317+
]
1318+
artifact_repository_package_names = [
1319+
pack.strip("\"'").split("==")[0] for pack in artifact_repository_packages
1320+
]
1321+
1322+
for package in package_names:
1323+
if package in artifact_repository_package_names:
1324+
raise ValueError(
1325+
f"Cannot create a function with duplicates between packages and artifact repository packages. packages: {all_packages}, artifact_repository_packages: {','.join(artifact_repository_packages)}"
1326+
)
13141327

13151328
artifact_repository_in_sql = (
13161329
f"ARTIFACT_REPOSITORY={artifact_repository}" if artifact_repository else ""

src/snowflake/snowpark/dataframe.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,10 @@ def to_snowpark_pandas(
13941394
self._ast_id = ast_id # reset the AST ID.
13951395

13961396
snowpandas_df = pd.read_snowflake(
1397-
name_or_query=temporary_table_name, index_col=index_col, columns=columns
1397+
name_or_query=temporary_table_name,
1398+
index_col=index_col,
1399+
columns=columns,
1400+
enforce_ordering=True,
13981401
) # pragma: no cover
13991402
else:
14001403
if len(self.queries["queries"]) > 1:

src/snowflake/snowpark/dataframe_analytics_functions.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from snowflake.snowpark._internal.utils import experimental, publicapi
1414
from snowflake.snowpark.column import Column, _to_col_if_str
1515
from snowflake.snowpark.functions import (
16+
_call_function,
1617
add_months,
17-
builtin,
1818
col,
1919
dateadd,
2020
from_unixtime,
@@ -262,9 +262,9 @@ def _perform_window_aggregations(
262262
if col_formatter
263263
else f"{column}_{func}{rename_suffix}"
264264
)
265-
agg_expression = builtin(func)(col(column + rename_suffix)).alias(
266-
agg_column_name
267-
)
265+
agg_expression = _call_function(
266+
func, col(column + rename_suffix, _emit_ast=False), _emit_ast=False
267+
).alias(agg_column_name, _emit_ast=False)
268268
agg_df = input_df.group_by(group_by_cols, _emit_ast=False).agg(
269269
agg_expression, _emit_ast=False
270270
)
@@ -369,7 +369,9 @@ def moving_agg(
369369
)
370370

371371
# Apply the user-specified aggregation function directly. Snowflake will handle any errors for invalid functions.
372-
agg_col = builtin(agg_func)(col(column)).over(window_spec)
372+
agg_col = _call_function(
373+
agg_func, col(column, _emit_ast=False), _emit_ast=False
374+
).over(window_spec, _emit_ast=False)
373375

374376
formatted_col_name = col_formatter(column, agg_func, window_size)
375377
if (
@@ -479,7 +481,9 @@ def cumulative_agg(
479481
for column, agg_funcs in aggs.items():
480482
for agg_func in agg_funcs:
481483
# Apply the user-specified aggregation function directly. Snowflake will handle any errors for invalid functions.
482-
agg_col = builtin(agg_func)(col(column)).over(window_spec)
484+
agg_col = _call_function(
485+
agg_func, col(column, _emit_ast=False), _emit_ast=False
486+
).over(window_spec, _emit_ast=False)
483487

484488
formatted_col_name = col_formatter(column, agg_func)
485489

0 commit comments

Comments
 (0)