Skip to content

Commit

Permalink
FEAT: Change reindex implementation to accomodate ponder index [do no…
Browse files Browse the repository at this point in the history
…t upstream] (modin-project#74)

Right now we always try to convert the index to a pandas.Index. That is not desirable for large indexes that we store in the service.

Signed-off-by: mvashishtha <[email protected]>
  • Loading branch information
mvashishtha authored and vnlitvinov committed Feb 27, 2023
1 parent 4427466 commit 1e0026f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions modin/pandas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2207,10 +2207,18 @@ def reindex(
"""
new_query_compiler = None
if index is not None:
if not isinstance(index, pandas.Index) or not index.equals(self.index):
new_query_compiler = self._query_compiler.reindex(
axis=0, labels=index, **kwargs
)
# TODO(REFACTOR): see how/whether to detect modin.pandas index in a better
# way. Right now in upsteram modin we always try to convert the index to a
# pandas.Index. That is not desirable for large indexes that we store in the
# service.
# Use duck typing to detect modin.pandas indexes, which are rpyc netrefs.
# pandas.Index and modin.pandas.Index and not much else has an attribute
# called "_summary".
if hasattr(index, "_summary"):
index = self._copy_index_metadata(source=self.index, destination=index)
new_query_compiler = self._query_compiler.reindex(
axis=0, labels=index, **kwargs
)
if new_query_compiler is None:
new_query_compiler = self._query_compiler
final_query_compiler = None
Expand Down

0 comments on commit 1e0026f

Please sign in to comment.