# Buggy code
def fetch_data(self, session_id, chunk_key, index_obj=None, compression_type=None):
    if compression_type is None:
        compression_type = dataserializer.CompressType(
            options.worker.transfer_compression
        )
    if index_obj is None:
        if options.vineyard.socket:
            target_devs = [
                DataStorageDevice.VINEYARD,
                DataStorageDevice.DISK,
            ]  # pragma: no cover
        else:
            target_devs = [DataStorageDevice.SHARED_MEMORY, DataStorageDevice.DISK]
        ev = self._result_copy_ref.start_copy(session_id, chunk_key, target_devs)
        if ev:
            ev.wait(options.worker.prepare_data_timeout)

        reader = self.storage_client.create_reader(
            session_id,
            chunk_key,
            target_devs,
            packed=True,
            packed_compression=compression_type,
            _promise=False,
        )

        with reader:
            pool = reader.get_io_pool()
            return pool.submit(reader.read).result()
    else:
        try:
            if options.vineyard.socket:
                memory_device = DataStorageDevice.VINEYARD  # pragma: no cover
            else:
                memory_device = DataStorageDevice.SHARED_MEMORY
            value = self.storage_client.get_object(
                session_id, chunk_key, [memory_device], _promise=False
            )
        except IOError:
            reader = self.storage_client.create_reader(
                session_id,
                chunk_key,
                [DataStorageDevice.DISK],
                packed=False,
                _promise=False,
            )
            with reader:
                pool = reader.get_io_pool()
                value = dataserializer.deserialize(pool.submit(reader.read).result())

        try:
            sliced_value = value.iloc[tuple(index_obj)]
        except AttributeError:
            sliced_value = value[tuple(index_obj)]

        return self._serialize_pool.submit(
            dataserializer.dumps, sliced_value, compress=compression_type
        ).result()


# Traceback (TypeError)
Traceback (most recent call last):
File "/Users/wenjun.swj/miniconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-9-60fd09690beb>", line 1, in <module>
df[df[0] > 0.5].execute()
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 643, in execute
return run()
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 639, in run
self.data.execute(session, **kw)
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 379, in execute
return run()
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 374, in run
session.run(self, **kw)
File "/Users/wenjun.swj/Code/mars/mars/session.py", line 505, in run
result = self._sess.run(*tileables, **kw)
File "/Users/wenjun.swj/Code/mars/mars/session.py", line 111, in run
res = self._executor.execute_tileables(tileables, **kw)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 451, in _inner
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 860, in execute_tileables
chunk_graph = chunk_graph_builder.build(
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 451, in _inner
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/tiles.py", line 347, in build
chunk_graph = super().build(
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 451, in _inner
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/tiles.py", line 262, in build
self._on_tile_failure(tileable_data.op, exc_info)
File "/Users/wenjun.swj/Code/mars/mars/tiles.py", line 301, in inner
raise exc_info[1].with_traceback(exc_info[2]) from None
File "/Users/wenjun.swj/Code/mars/mars/tiles.py", line 242, in build
tiled = self._tile(tileable_data, tileable_graph)
File "/Users/wenjun.swj/Code/mars/mars/tiles.py", line 337, in _tile
return super()._tile(tileable_data, tileable_graph)
File "/Users/wenjun.swj/Code/mars/mars/tiles.py", line 201, in _tile
tds[0]._inplace_tile()
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 168, in _inplace_tile
return handler.inplace_tile(self)
File "/Users/wenjun.swj/Code/mars/mars/tiles.py", line 136, in inplace_tile
dispatched = self.dispatch(to_tile.op)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 451, in _inner
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/tiles.py", line 119, in dispatch
tiled = op_cls.tile(op)
File "/Users/wenjun.swj/Code/mars/mars/dataframe/indexing/getitem.py", line 273, in tile
return cls.tile_with_mask(op)
File "/Users/wenjun.swj/Code/mars/mars/dataframe/indexing/getitem.py", line 287, in tile_with_mask
align_dataframe_series(in_df, mask, axis='index')
File "/Users/wenjun.swj/Code/mars/mars/dataframe/align.py", line 713, in align_dataframe_series
index_splits, index_nsplits = _calc_axis_splits(left.index_value, right.index_value,
File "/Users/wenjun.swj/Code/mars/mars/dataframe/align.py", line 490, in _calc_axis_splits
right_splits = left_splits = [[c] for c in left_chunk_index_min_max]
TypeError: 'NoneType' object is not iterable

# Fixed code
def fetch_data(self, session_id, chunk_key, index_obj=None, compression_type=None):
    logger.debug("Sending data %s from %s", chunk_key, self.uid)
    if compression_type is None:
        compression_type = dataserializer.CompressType(
            options.worker.transfer_compression
        )
    if index_obj is None:
        if options.vineyard.socket:
            target_devs = [
                DataStorageDevice.VINEYARD,
                DataStorageDevice.DISK,
            ]  # pragma: no cover
        else:
            target_devs = [DataStorageDevice.SHARED_MEMORY, DataStorageDevice.DISK]
        ev = self._result_copy_ref.start_copy(session_id, chunk_key, target_devs)
        if ev:
            ev.wait(options.worker.prepare_data_timeout)

        reader = self.storage_client.create_reader(
            session_id,
            chunk_key,
            target_devs,
            packed=True,
            packed_compression=compression_type,
            _promise=False,
        )

        with reader:
            pool = reader.get_io_pool()
            return pool.submit(reader.read).result()
    else:
        try:
            if options.vineyard.socket:
                memory_device = DataStorageDevice.VINEYARD  # pragma: no cover
            else:
                memory_device = DataStorageDevice.SHARED_MEMORY
            value = self.storage_client.get_object(
                session_id, chunk_key, [memory_device], _promise=False
            )
        except IOError:
            reader = self.storage_client.create_reader(
                session_id,
                chunk_key,
                [DataStorageDevice.DISK],
                packed=False,
                _promise=False,
            )
            with reader:
                pool = reader.get_io_pool()
                value = dataserializer.deserialize(pool.submit(reader.read).result())

        try:
            sliced_value = value.iloc[tuple(index_obj)]
        except AttributeError:
            sliced_value = value[tuple(index_obj)]

        return self._serialize_pool.submit(
            dataserializer.dumps, sliced_value, compress=compression_type
        ).result()