Skip to content

Commit

Permalink
SNOW-990324: Fix inconsistency when calling na.fill (#1182)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jrose authored Dec 19, 2023
1 parent 5f208fd commit 69a0514
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## 1.12.0 (TBD)

### Bug Fixes

- Fixed a bug in `DataFrame.na.fill` that caused Boolean values to erroneously override integer values.
- Fixed sql simplifier for filter with window function columns in select.

## 1.11.1 (2023-12-07)
Expand Down
13 changes: 13 additions & 0 deletions src/snowflake/snowpark/dataframe_na_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def _is_value_type_matching_for_na_function(
value is None
or (
isinstance(value, int)
# bool is a subclass of int, but we don't want to consider it numeric
and not isinstance(value, bool)
and isinstance(datatype, (IntegerType, LongType, FloatType, DoubleType))
)
or (isinstance(value, float) and isinstance(datatype, (FloatType, DoubleType)))
Expand Down Expand Up @@ -285,6 +287,17 @@ def fill(
|3.14 |15 |
--------------
<BLANKLINE>
>>> df2 = session.create_dataframe([[1.0, True], [2.0, False], [3.0, False], [None, None]]).to_df("a", "b")
>>> df2.na.fill(True).show()
----------------
|"A" |"B" |
----------------
|1.0 |True |
|2.0 |False |
|3.0 |False |
|NULL |True |
----------------
<BLANKLINE>
Note:
If the type of a given value in ``value`` doesn't match the
Expand Down

0 comments on commit 69a0514

Please sign in to comment.