**Describe the bug**
https://github.com/ClickHouse/ClickHouse/pull/18899#issuecomment-757571194

{
    auto last_granule = granules_written.back();
    
    if (!last_granule.is_complete)
    {
        if (settings.blocks_are_granules_size)
            throw Exception(ErrorCodes::LOGICAL_ERROR, "Incomplete granules are not allowed while blocks are granules size. "
                "Mark number {} (rows {}), rows written in last mark {}, rows to write in last mark from block {} (from row {}), total marks currently {}",
                last_granule.mark_number, index_granularity.getMarkRows(last_granule.mark_number), rows_written_in_last_mark,
                last_granule.rows_to_write, last_granule.start_row, index_granularity.getMarksCount());
        
        setCurrentMark(getCurrentMark() + granules_written.size() - 1);
        bool still_in_the_same_granule = granules_written.size() == 1;
        
        
        if (still_in_the_same_granule)
            rows_written_in_last_mark += last_granule.rows_to_write;
        else
            rows_written_in_last_mark = last_granule.rows_to_write;
    }
    else
    {
        setCurrentMark(getCurrentMark() + granules_written.size());
        rows_written_in_last_mark = 0;
    }
}
void MergeTreeDataPartWriterWide::write(const Block & block, const IColumn::Permutation * permutation)