Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1018660: use split_blocks=True by default #1234

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

### New Features

- Use `split_blocks=True` by default during `to_pandas` conversion for optimal memory allocation. This parameter is passed to `pyarrow.Table.to_pandas` that enables `PyArrow` to split the memory allocation into smaller, more manageable blocks instead of allocating a single contiguous block thus giving better memory management when dealing with larger datasets.

### Bug Fixes

- Fixed a bug in `DataFrame.to_pandas` that caused an error when evaluating on a dataframe with an IntergerType column with null values.
Expand Down
4 changes: 2 additions & 2 deletions src/snowflake/snowpark/_internal/server_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,11 @@ def _to_data_or_iter(
functools.partial(
_fix_pandas_df_fixed_type, results_cursor=results_cursor
),
results_cursor.fetch_pandas_batches(),
results_cursor.fetch_pandas_batches(split_blocks=True),
)
if to_iter
else _fix_pandas_df_fixed_type(
results_cursor.fetch_pandas_all(), results_cursor
results_cursor.fetch_pandas_all(split_blocks=True), results_cursor
)
)
except NotSupportedError:
Expand Down
4 changes: 2 additions & 2 deletions src/snowflake/snowpark/mock/_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,11 @@ def _to_data_or_iter(
functools.partial(
_fix_pandas_df_fixed_type, results_cursor=results_cursor
),
results_cursor.fetch_pandas_batches(),
results_cursor.fetch_pandas_batches(split_blocks=True),
)
if to_iter
else _fix_pandas_df_fixed_type(
results_cursor.fetch_pandas_all(), results_cursor
results_cursor.fetch_pandas_all(split_blocks=True), results_cursor
)
)
except NotSupportedError:
Expand Down
Loading