https://pastila.nl/?00ad187f/ecfb3d92d2e879533cc3aea0536ab3d7

22.3 Exception on client:
Code: 49. DB::Exception: offsets_column has data inconsistent with nested_column: data for INSERT was parsed from query. (LOGICAL_ERROR)

22.7 the insert hangs

21.8.4 Received exception from server (version 21.8.4): Code: 62. DB::Exception: Received from localhost:9000. DB::Exception: Empty query.


{
    size_t col_size = size();
    if (col_size != replicate_offsets.size())
        throw Exception("Size of offsets doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);
    MutableColumnPtr res = cloneEmpty();
    if (0 == col_size)
        return res;
    ColumnArray & res_arr = assert_cast<ColumnArray &>(*res);
    const ColumnString & src_string = typeid_cast<const ColumnString &>(*data);
    const ColumnString::Chars & src_chars = src_string.getChars();
    const Offsets & src_string_offsets = src_string.getOffsets();
    const Offsets & src_offsets = getOffsets();
    ColumnString::Chars & res_chars = typeid_cast<ColumnString &>(res_arr.getData()).getChars();
    Offsets & res_string_offsets = typeid_cast<ColumnString &>(res_arr.getData()).getOffsets();
    Offsets & res_offsets = res_arr.getOffsets();
    res_chars.reserve(src_chars.size() / col_size * replicate_offsets.back());
    res_string_offsets.reserve(src_string_offsets.size() / col_size * replicate_offsets.back());
    res_offsets.reserve(replicate_offsets.back());
    Offset prev_replicate_offset = 0;
    Offset prev_src_offset = 0;
    Offset prev_src_string_offset = 0;
    Offset current_res_offset = 0;
    Offset current_res_string_offset = 0;
    for (size_t i = 0; i < col_size; ++i)
    {
        
        size_t size_to_replicate = replicate_offsets[i] - prev_replicate_offset;
        
        size_t value_size = src_offsets[i] - prev_src_offset;