See https://github.com/ClickHouse/ClickHouse/pull/13193
{
            ssize_t mid = (low + high) / 2;
            if (!less(last_chunk.getColumns(), chunk.getColumns(), last_chunk.getNumRows() - 1, mid, description_sorted))
                low = mid;
            else
                high = mid;
        }
        size_t tail_pos = high;
        
        
        if (tail_pos != size)
        {
            auto source_columns = chunk.detachColumns();
            Columns tail_columns;
            for (auto & source_column : source_columns)
            {
                tail_columns.emplace_back(source_column->cut(tail_pos, size - tail_pos));
                source_column = source_column->cut(0, tail_pos);
            }
            chunks.emplace_back(std::move(source_columns), tail_pos);
            tail_chunk.setColumns(std::move(tail_columns), size - tail_pos);
            stage = Stage::Generate;
            return;
        }
    }
    
    
    chunks.push_back(std::move(chunk));
}
void FinishSortingTransform::generate()