dbms: fixed writing arrays [#CONV-8022].

This commit is contained in:
Alexey Milovidov 2013-06-27 17:11:25 +00:00
parent 23046fe1fe
commit 4bc51482ce

View File

@ -47,9 +47,9 @@ void DataTypeArray::serializeBinary(const IColumn & column, WriteBuffer & ostr,
const ColumnArray & column_array = dynamic_cast<const ColumnArray &>(column); const ColumnArray & column_array = dynamic_cast<const ColumnArray &>(column);
const ColumnArray::Offsets_t & offsets = column_array.getOffsets(); const ColumnArray::Offsets_t & offsets = column_array.getOffsets();
size_t nested_offset = offset ? offsets[offset] : 0; size_t nested_offset = offset ? offsets[offset - 1] : 0;
size_t nested_limit = limit && offset + limit < offsets.size() size_t nested_limit = limit && (offset + limit < offsets.size())
? offsets[offset + limit] - nested_offset ? offsets[offset + limit - 1] - nested_offset
: 0; : 0;
nested->serializeBinary(column_array.getData(), ostr, nested_offset, nested_limit); nested->serializeBinary(column_array.getData(), ostr, nested_offset, nested_limit);