Skip to content

Commit

Permalink
Merge branch 'main' into changelog-update-post-1.12.1-release
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-aalam authored Feb 8, 2024
2 parents 86b16f7 + 24a7ae3 commit 915de1a
Show file tree
Hide file tree
Showing 16 changed files with 979 additions and 14 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Release History

## 1.13.0 (TBD)

### New Features

- Added support for an optional `date_part` argument in function `last_day`
- `SessionBuilder.app_name` will set the query_tag after the session is created.

### Bug Fixes

- Fixed a bug in `DataFrame.to_local_iterator` where the iterator could yield wrong results if another query is executed before the iterator finishes due to wrong isolation level. For details, please see #945.
- Fixed a bug that truncated table names in error messages while running a plan with local testing enabled.
- Fixed a bug that `Session.range` returns empty result when the range is large.

## 1.12.1 (2024-02-08)

### Improvements
Expand Down Expand Up @@ -28,7 +41,9 @@
- `sign`/`signum`
- Added the following functions to `DataFrame.analytics`:
- Added the `moving_agg` function in `DataFrame.analytics` to enable moving aggregations like sums and averages with multiple window sizes.
- Added the `cummulative_agg` function in `DataFrame.analytics` to enable moving aggregations like sums and averages with multiple window sizes.
- Added the `cummulative_agg` function in `DataFrame.analytics` to enable commulative aggregations like sums and averages on multiple columns.
- Added the `compute_lag` and `compute_lead` functions in `DataFrame.analytics` for enabling lead and lag calculations on multiple columns.
- Added the `time_series_agg` function in `DataFrame.analytics` to enable time series aggregations like sums and averages with multiple time windows.

### Bug Fixes

Expand Down
6 changes: 6 additions & 0 deletions docs/source/_templates/autosummary/accessor_method.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{ fullname }}
{{ underline }}

.. currentmodule:: {{ module + "." + objname.split(".")[0] }}

.. automethod:: {{ ".".join(objname.split(".")[1:]) }}
13 changes: 13 additions & 0 deletions docs/source/session.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ Snowpark Session

Session


.. rubric:: SessionBuilder

.. autosummary::
:toctree: api/
:template: autosummary/accessor_method.rst

Session.SessionBuilder.app_name
Session.SessionBuilder.config
Session.SessionBuilder.configs
Session.SessionBuilder.create
Session.SessionBuilder.getOrCreate

.. rubric:: Methods

..
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def sort_statement(order: List[str], child: str) -> str:
def range_statement(start: int, end: int, step: int, column_name: str) -> str:
range = end - start

if range * step < 0:
if (range > 0 > step) or (range < 0 < step):
count = 0
else:
count = math.ceil(range / step)
Expand Down
10 changes: 9 additions & 1 deletion src/snowflake/snowpark/_internal/server_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,16 @@ def _to_data_or_iter(
results_cursor: SnowflakeCursor,
to_pandas: bool = False,
to_iter: bool = False,
num_statements: Optional[int] = None,
) -> Dict[str, Any]:
if (
to_iter and not to_pandas
): # Fix for SNOW-869536, to_pandas doesn't have this issue, SnowflakeCursor.fetch_pandas_batches already handles the isolation.
new_cursor = results_cursor.connection.cursor()
new_cursor.execute(
f"SELECT * FROM TABLE(RESULT_SCAN('{results_cursor.sfqid}'))"
)
results_cursor = new_cursor

if to_pandas:
try:
data_or_iter = (
Expand Down
Loading

0 comments on commit 915de1a

Please sign in to comment.