# Buggy code
def tile(cls, op):
    from ..indexing.slice import TensorSlice

    inputs = unify_chunks(*op.inputs)
    output = op.outputs[0]
    axis = op.axis

    output_nsplits = (
        inputs[0].nsplits[:axis] + ((1,) * len(inputs),) + inputs[0].nsplits[axis:]
    )
    output_idxes = itertools.product(*[range(len(nsplit)) for nsplit in output_nsplits])

    out_chunks = []
    for idx in output_idxes:
        input_idx = idx[:axis] + idx[axis + 1 :]
        i = idx[axis]
        input_chunk = inputs[i].cix[input_idx]
        slices = (
            [slice(None)] * axis
            + [np.newaxis]
            + [slice(None)] * (len(input_idx) - axis)
        )
        shape = input_chunk.shape[:axis] + (1,) + input_chunk.shape[axis:]
        chunk_op = TensorSlice(slices=slices, dtype=op.dtype, sparse=op.sparse)
        out_chunk = chunk_op.new_chunk(
            [input_chunk], shape=shape, index=idx, order=output.order
        )
        out_chunks.append(out_chunk)

    new_op = op.copy()
    return new_op.new_tensors(
        op.inputs, output.shape, chunks=out_chunks, nsplits=output_nsplits
    )


# Traceback (NotImplementedError)
In [52]: df = md.DataFrame(index=[1, 2, 3])

In [53]: df['a'] = md.Series(['a', 'b', 'c'], index=[2, 3, 4])
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-53-f550a59ef82c> in <module>
----> 1 df['a'] = md.Series(['a', 'b', 'c'], index=[2, 3, 4])

~/Workspace/mars/mars/dataframe/indexing/setitem.py in dataframe_setitem(df, col, value)
182 def dataframe_setitem(df, col, value):
183     op = DataFrameSetitem(target=df, indexes=col, value=value)
--> 184     return op(df, value)

~/Workspace/mars/mars/utils.py in _inner(*args, **kwargs)
457         @functools.wraps(func)
458         def _inner(*args, **kwargs):
--> 459             with self:
460                 return func(*args, **kwargs)
461

~/Workspace/mars/mars/dataframe/indexing/setitem.py in __call__(self, target, value)
83
84             if value.index_value.key != target.index_value.key:  # pragma: no cover
---> 85                 raise NotImplementedError('Does not support setting value '
86                                           'with different index for now')
87

NotImplementedError: Does not support setting value with different index for now

# Fixed code
def tile(cls, op):
    from ..indexing.slice import TensorSlice

    check_chunks_unknown_shape(op.inputs, TilesError)

    if len(set([inp.shape for inp in op.inputs])) != 1:
        # check shape again when input has unknown shape
        raise ValueError("all input tensors must have the same shape")

    inputs = unify_chunks(*op.inputs)
    output = op.outputs[0]
    axis = op.axis

    output_nsplits = (
        inputs[0].nsplits[:axis] + ((1,) * len(inputs),) + inputs[0].nsplits[axis:]
    )
    output_idxes = itertools.product(*[range(len(nsplit)) for nsplit in output_nsplits])

    out_chunks = []
    for idx in output_idxes:
        input_idx = idx[:axis] + idx[axis + 1 :]
        i = idx[axis]
        input_chunk = inputs[i].cix[input_idx]
        slices = (
            [slice(None)] * axis
            + [np.newaxis]
            + [slice(None)] * (len(input_idx) - axis)
        )
        shape = input_chunk.shape[:axis] + (1,) + input_chunk.shape[axis:]
        chunk_op = TensorSlice(slices=slices, dtype=op.dtype, sparse=op.sparse)
        out_chunk = chunk_op.new_chunk(
            [input_chunk], shape=shape, index=idx, order=output.order
        )
        out_chunks.append(out_chunk)

    new_op = op.copy()
    return new_op.new_tensors(
        op.inputs, output.shape, chunks=out_chunks, nsplits=output_nsplits
    )