# Buggy code
def _get_chunk_index_min_max(cls, df, index_type, axis):
    index = getattr(df, index_type)
    if not index.is_monotonic_increasing_or_decreasing and df.chunk_shape[axis] > 1:
        return

    chunk_index_min_max = []
    for i in range(df.chunk_shape[axis]):
        chunk_idx = [0, 0]
        chunk_idx[axis] = i
        chunk = df.cix[tuple(chunk_idx)]
        chunk_index = getattr(chunk, index_type)
        min_val = chunk_index.min_val
        min_val_close = chunk_index.min_val_close
        max_val = chunk_index.max_val
        max_val_close = chunk_index.max_val_close
        if min_val is None or max_val is None:
            return
        chunk_index_min_max.append((min_val, min_val_close, max_val, max_val_close))

    if index.is_monotonic_decreasing:
        return list(reversed(chunk_index_min_max)), False

    if cls._check_overlap(chunk_index_min_max):
        return
    return chunk_index_min_max, True


# Traceback (KeyError)
Traceback (most recent call last):
File "/Users/hetao/mars/mars/tiles.py", line 111, in _dispatch
handler = self._handlers[op_cls]
KeyError: <class 'mars.dataframe.expressions.arithmetic.add.DataFrameAdd'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/hetao/mars/mars/core.py", line 554, in execute
return session.run(self, **kw)
File "/Users/hetao/mars/mars/session.py", line 115, in run
result = self._sess.run(*tileables, **kw)
File "/Users/hetao/mars/mars/session.py", line 56, in run
res = self._executor.execute_tileables(tileables, **kw)
File "/Users/hetao/mars/mars/utils.py", line 364, in _wrapped
return func(*args, **kwargs)
File "/Users/hetao/mars/mars/executor.py", line 499, in execute_tileables
tileable.tiles()
File "/Users/hetao/mars/mars/core.py", line 474, in tiles
return handler.tiles(self)
File "/Users/hetao/mars/mars/tiles.py", line 174, in tiles
tiled = self._dispatch(node.op)
File "/Users/hetao/mars/mars/utils.py", line 364, in _wrapped
return func(*args, **kwargs)
File "/Users/hetao/mars/mars/tiles.py", line 116, in _dispatch
return op_cls.tile(op)
File "/Users/hetao/mars/mars/dataframe/expressions/arithmetic/core.py", line 527, in tile
return cls._tile_both_dataframes(op)
File "/Users/hetao/mars/mars/dataframe/expressions/arithmetic/core.py", line 516, in _tile_both_dataframes
out_chunks = cls._gen_out_chunks_with_all_shuffle(op, out_shape, left, right)
File "/Users/hetao/mars/mars/dataframe/expressions/arithmetic/core.py", line 461, in _gen_out_chunks_with_all_shuffle
reduce_op.new_chunk([proxy_chunk], shape=(np.nan, np.nan), index=out_idx))
File "/Users/hetao/mars/mars/core.py", line 650, in new_chunk
return self.new_chunks(inputs, kws=kws, **kw)[0]
File "/Users/hetao/mars/mars/core.py", line 644, in new_chunks
return self._new_chunks(inputs, kws=kws, **kwargs)
File "/Users/hetao/mars/mars/core.py", line 618, in _new_chunks
chunk = self._create_chunk(j, index, **create_chunk_kw)
File "/Users/hetao/mars/mars/dataframe/expressions/arithmetic/core.py", line 188, in _create_chunk
all_dtypes = [c.op.column_shuffle_segments[index[1]] for c in index_align_map_chunks
File "/Users/hetao/mars/mars/dataframe/expressions/arithmetic/core.py", line 189, in <listcomp>
if c.index[0] == index_align_map_chunks[0].index[0]]
IndexError: list index out of range


# Fixed code
def _get_chunk_index_min_max(cls, df, index_type, axis):
    index = getattr(df, index_type)

    chunk_index_min_max = []
    for i in range(df.chunk_shape[axis]):
        chunk_idx = [0, 0]
        chunk_idx[axis] = i
        chunk = df.cix[tuple(chunk_idx)]
        chunk_index = getattr(chunk, index_type)
        min_val = chunk_index.min_val
        min_val_close = chunk_index.min_val_close
        max_val = chunk_index.max_val
        max_val_close = chunk_index.max_val_close
        if min_val is None or max_val is None:
            return
        chunk_index_min_max.append((min_val, min_val_close, max_val, max_val_close))

    if index.is_monotonic_decreasing:
        return list(reversed(chunk_index_min_max)), False

    if cls._check_overlap(chunk_index_min_max):
        return
    return chunk_index_min_max, True