Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#### Bug Fixes

- Fixed a bug in local testing mode that caused a column to contain None when it should contain 0
- Fixed a bug in StructField.from_json that prevented TimestampTypes with tzinfo from being parsed correctly.

### Snowpark pandas API Updates
Expand Down
6 changes: 3 additions & 3 deletions src/snowflake/snowpark/mock/_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1881,9 +1881,9 @@ def flatten_object_cell_func(cell):
# This requires us to wrap the aggregation function with extract logic to handle this special case.
def agg_function(column):
return (
agg_functions[agg_function_name](column.dropna())
if column.any()
else sentinel
sentinel
if column.isnull().all()
else agg_functions[agg_function_name](column.dropna())
)

default = (
Expand Down
11 changes: 11 additions & 0 deletions tests/integ/scala/test_dataframe_aggregate_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ def test_pivot(session):
)


def test_pivot_snow_1869802_repro(session):
df = session.create_dataframe(
[[1, "A", 10], [1, "B", 0], [2, "A", 11], [2, "B", 12]]
)
Utils.check_answer(
df.pivot(pivot_col="_2", values=["A", "B"]).function("min")("_3"),
[Row(1, 10, 0), Row(2, 11, 12)],
False,
)


@pytest.mark.parametrize(
"func,expected",
[
Expand Down
Loading