Skip to content

Commit

Permalink
Fix integer overflow when doing a mask for Windows users (#858)
Browse files Browse the repository at this point in the history
* Resolves #852
* Changes where we do the cumulative sum, no longer incorporating INT_MAX into the sum result
  • Loading branch information
devin-petersohn authored Nov 4, 2019
1 parent 4661e81 commit cb219ca
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions modin/engines/base/frame/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,15 +544,11 @@ def _get_dict_of_block_index(self, axis, indices, ordered=False):
else:
indices = np.array(indices)
if not axis:
# INT_MAX to make sure we don't try to compute on partitions that don't
# exist.
cumulative = np.array(
np.append(self._column_widths[:-1], np.iinfo(np.int32).max)
).cumsum()
bins = np.array(self._column_widths)
else:
cumulative = np.array(
np.append(self._row_lengths[:-1], np.iinfo(np.int32).max)
).cumsum()
bins = np.array(self._row_lengths)
# INT_MAX to make sure we don't try to compute on partitions that don't exist.
cumulative = np.append(bins[:-1].cumsum(), np.iinfo(bins.dtype).max)

def internal(block_idx, global_index):
return (
Expand Down

0 comments on commit cb219ca

Please sign in to comment.