Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-helmeleegy committed Oct 25, 2024
1 parent e60801a commit 4f2784f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/snowflake/snowpark/modin/plugin/_internal/type_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ def column_astype(
if to_dtype == np.object_:
return to_variant(curr_col)
if from_sf_type == to_sf_type:
if isinstance(to_sf_type, BooleanType):
new_col = to_variant(curr_col)
# treat NULL values in boolean columns as False to match pandas behavior
return iff(curr_col.is_null(), False, curr_col)
return curr_col

if isinstance(to_sf_type, _IntegralType) and "int64" not in str(to_dtype).lower():
Expand Down Expand Up @@ -387,7 +391,7 @@ def column_astype(
# astype should not have any effect on NULL values except when casting to boolean
if isinstance(to_sf_type, BooleanType):
# treat NULL values in boolean columns as False to match pandas behavior
return iff(curr_col.is_null(), pandas_lit(False), new_col)
return iff(curr_col.is_null(), False, new_col)
else:
return iff(curr_col.is_null(), None, new_col)

Expand Down

0 comments on commit 4f2784f

Please sign in to comment.