From cb219ca4d3bbc8328cfad5d40dd23eda01a7439c Mon Sep 17 00:00:00 2001 From: Devin Petersohn Date: Mon, 4 Nov 2019 14:33:59 -0800 Subject: [PATCH] Fix integer overflow when doing a mask for Windows users (#858) * Resolves #852 * Changes where we do the cumulative sum, no longer incorporating INT_MAX into the sum result --- modin/engines/base/frame/data.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modin/engines/base/frame/data.py b/modin/engines/base/frame/data.py index f86090fc757..bfce32cfe6e 100644 --- a/modin/engines/base/frame/data.py +++ b/modin/engines/base/frame/data.py @@ -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 (