Skip to content

Commit

Permalink
add none checking
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-vbudati committed Sep 13, 2024
1 parent bb6242b commit 9a1bce4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/snowflake/snowpark/modin/plugin/extensions/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ 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`).
"""
if self._parent is not None and self._parent._query_compiler is self._parent_qc:
if self._parent._query_compiler is self._parent_qc:
new_query_compiler = self._parent_qc.set_index_names(names)
self._parent._update_inplace(new_query_compiler=new_query_compiler)
# Update the query compiler after naming operation.
Expand Down Expand Up @@ -762,7 +762,8 @@ def name(self, value: Hashable) -> None:
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.
self._parent.check_and_update_parent_qc_index_names([value])
if self._parent is not None:
self._parent.check_and_update_parent_qc_index_names([value])

def _get_names(self) -> list[Hashable]:
"""
Expand Down Expand Up @@ -790,7 +791,8 @@ def _set_names(self, values: list) -> None:
self._query_compiler = self._query_compiler.set_index_names(values)
# Update the name of the parent's index only if the parent's current query compiler
# matches the recorded query compiler.
self._parent.check_and_update_parent_qc_index_names(values)
if self._parent is not None:
self._parent.check_and_update_parent_qc_index_names(values)

names = property(fset=_set_names, fget=_get_names)

Expand Down

0 comments on commit 9a1bce4

Please sign in to comment.