Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyPavlenko committed Jan 24, 2024
1 parent ca4f315 commit 0deed6c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def copy(
op=no_default,
index_cols=no_default,
uses_rowid=no_default,
has_unsupported_data=no_default,
):
"""
Copy this DataFrame.
Expand All @@ -280,6 +281,8 @@ def copy(
uses_rowid : bool, optional
True for frames which require access to the virtual 'rowid' column
for its execution.
has_unsupported_data : bool, optional
True for frames holding data not supported by Arrow or HDK storage format.
Returns
-------
Expand All @@ -300,6 +303,8 @@ def copy(
index_cols = self._index_cols
if uses_rowid is no_default:
uses_rowid = self._uses_rowid
if has_unsupported_data is no_default:
has_unsupported_data = self._has_unsupported_data

Check warning on line 307 in modin/experimental/core/execution/native/implementations/hdk_on_native/dataframe/dataframe.py

View check run for this annotation

Codecov / codecov/patch

modin/experimental/core/execution/native/implementations/hdk_on_native/dataframe/dataframe.py#L306-L307

Added lines #L306 - L307 were not covered by tests
return self.__constructor__(
partitions=partitions,
index=index,
Expand All @@ -311,7 +316,7 @@ def copy(
index_cols=index_cols,
uses_rowid=uses_rowid,
force_execution_mode=self._force_execution_mode,
has_unsupported_data=self._has_unsupported_data,
has_unsupported_data=has_unsupported_data,
)

def id_str(self):
Expand Down Expand Up @@ -1800,16 +1805,28 @@ def _insert_list_col(self, idx, name, value, dtype=None, op=None):
"""
cols = self.columns.tolist()
cols.insert(idx, name)
has_unsupported_data = self._has_unsupported_data
if self._index_cols:
idx += len(self._index_cols)
if dtype is None:
part, dtype = self._partitions[0][0].insert(idx, name, value)
part = np.array([[part]])
if not has_unsupported_data:
try:
ensure_supported_dtype(dtype)
except NotImplementedError:
has_unsupported_data = True

Check warning on line 1818 in modin/experimental/core/execution/native/implementations/hdk_on_native/dataframe/dataframe.py

View check run for this annotation

Codecov / codecov/patch

modin/experimental/core/execution/native/implementations/hdk_on_native/dataframe/dataframe.py#L1806-L1818

Added lines #L1806 - L1818 were not covered by tests
else:
part = None
dtypes = self._dtypes.tolist()
dtypes.insert(idx, dtype)
return self.copy(partitions=part, columns=cols, dtypes=dtypes, op=op)
return self.copy(

Check warning on line 1823 in modin/experimental/core/execution/native/implementations/hdk_on_native/dataframe/dataframe.py

View check run for this annotation

Codecov / codecov/patch

modin/experimental/core/execution/native/implementations/hdk_on_native/dataframe/dataframe.py#L1820-L1823

Added lines #L1820 - L1823 were not covered by tests
partitions=part,
columns=cols,
dtypes=dtypes,
op=op,
has_unsupported_data=has_unsupported_data,
)

def _list_to_df(self, name, value, add_index):

Check warning on line 1831 in modin/experimental/core/execution/native/implementations/hdk_on_native/dataframe/dataframe.py

View check run for this annotation

Codecov / codecov/patch

modin/experimental/core/execution/native/implementations/hdk_on_native/dataframe/dataframe.py#L1831

Added line #L1831 was not covered by tests
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def insert(self, idx: int, name: str, value: AnyArrayLike):
else:
raise NotImplementedError(f"Insertion into {type(data)}")

ensure_supported_dtype(dtype)
return HdkOnNativeDataframePartition(data), dtype

Check warning on line 160 in modin/experimental/core/execution/native/implementations/hdk_on_native/partitioning/partition.py

View check run for this annotation

Codecov / codecov/patch

modin/experimental/core/execution/native/implementations/hdk_on_native/partitioning/partition.py#L160

Added line #L160 was not covered by tests

@property
Expand Down

0 comments on commit 0deed6c

Please sign in to comment.