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.


{
    const ColumnTuple & tuple = assert_cast<const ColumnTuple &>(*data);
    
    size_t tuple_size = tuple.tupleSize();
    if (tuple_size == 0)
        throw Exception("Logical error: empty tuple", ErrorCodes::LOGICAL_ERROR);
    Columns temporary_arrays(tuple_size);
    for (size_t i = 0; i < tuple_size; ++i)
        temporary_arrays[i] = ColumnArray(tuple.getColumns()[i]->assumeMutable(), getOffsetsPtr()->assumeMutable())
                .replicate(replicate_offsets);
    Columns tuple_columns(tuple_size);
    for (size_t i = 0; i < tuple_size; ++i)
        tuple_columns[i] = assert_cast<const ColumnArray &>(*temporary_arrays[i]).getDataPtr();
    return ColumnArray::create(
        ColumnTuple::create(tuple_columns),
        assert_cast<const ColumnArray &>(*temporary_arrays.front()).getOffsetsPtr());
}
void ColumnArray::gather(ColumnGathererStream & gatherer)
{
    gatherer.gather(*this);
}
size_t ColumnArray::getNumberOfDimensions() const
{
    const auto * nested_array = checkAndGetColumn<ColumnArray>(*data);
    if (!nested_array)
        return 1;
    return 1 + nested_array->getNumberOfDimensions();   
}
}