Skip to content

Commit

Permalink
update comments and changelog to specifically mention inplace updates…
Browse files Browse the repository at this point in the history
… of parents
  • Loading branch information
sfc-gh-vbudati committed Sep 16, 2024
1 parent 807b769 commit a70f20c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#### Bug Fixes

- Fixed a bug where an `Index` object created from a `Series`/`DataFrame` incorrectly updates the `Series`/`DataFrame`'s index name when it is not supposed to.
- Fixed a bug where an `Index` object created from a `Series`/`DataFrame` incorrectly updates the `Series`/`DataFrame`'s index name after an inplace update has been applied to the original `Series`/`DataFrame`.


## 1.22.1 (2024-09-11)
Expand Down
9 changes: 5 additions & 4 deletions src/snowflake/snowpark/modin/plugin/extensions/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def __init__(self, parent: DataFrame | Series) -> None:

def check_and_update_parent_qc_index_names(self, names: list) -> None:
"""
Update the Index and its parent's index names if the parent's current query compiler matches
the recorded query compiler (`_parent_qc`).
Update the Index and its parent's index names if the query compiler associated with the parent is
different from the original query compiler recorded, i.e., an inplace update has been applied to the parent.
"""
if self._parent._query_compiler is self._parent_qc:
new_query_compiler = self._parent_qc.set_index_names(names)
Expand Down Expand Up @@ -760,8 +760,9 @@ def name(self, value: Hashable) -> None:
if not is_hashable(value):
raise TypeError(f"{type(self).__name__}.name must be a hashable type")
self._query_compiler = self._query_compiler.set_index_names([value])
# Update the name of the parent's index only if the parent's current query compiler
# matches the recorded query compiler.
# Update the name of the parent's index only if an inplace update is performed on
# the parent object, i.e., the parent's current query compiler matches the originally
# recorded query compiler.
if self._parent is not None:
self._parent.check_and_update_parent_qc_index_names([value])

Expand Down

0 comments on commit a70f20c

Please sign in to comment.