mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Addition to Amos Bird changes #3920
This commit is contained in:
parent
a5e354fba9
commit
0630e67a21
@ -226,14 +226,14 @@ public:
|
||||
|
||||
// Advance column offsets
|
||||
auto & to_keys_offsets = to_keys_arr.getOffsets();
|
||||
to_keys_offsets.push_back((to_keys_offsets.empty() ? 0 : to_keys_offsets.back()) + size);
|
||||
to_keys_offsets.push_back(to_keys_offsets.back() + size);
|
||||
to_keys_col.reserve(size);
|
||||
|
||||
for (size_t col = 0; col < values_types.size(); ++col)
|
||||
{
|
||||
auto & to_values_arr = static_cast<ColumnArray &>(to_tuple.getColumn(col + 1));
|
||||
auto & to_values_offsets = to_values_arr.getOffsets();
|
||||
to_values_offsets.push_back((to_values_offsets.empty() ? 0 : to_values_offsets.back()) + size);
|
||||
to_values_offsets.push_back(to_values_offsets.back() + size);
|
||||
to_values_arr.getData().reserve(size);
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ void DataTypeArray::deserializeBinary(IColumn & column, ReadBuffer & istr) const
|
||||
throw;
|
||||
}
|
||||
|
||||
offsets.push_back((offsets.empty() ? 0 : offsets.back()) + size);
|
||||
offsets.push_back(offsets.back() + size);
|
||||
}
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ void DataTypeArray::deserializeBinaryBulkWithMultipleStreams(
|
||||
IColumn & nested_column = column_array.getData();
|
||||
|
||||
/// Number of values corresponding with `offset_values` must be read.
|
||||
size_t last_offset = (offset_values.empty() ? 0 : offset_values.back());
|
||||
size_t last_offset = offset_values.back();
|
||||
if (last_offset < nested_column.size())
|
||||
throw Exception("Nested column is longer than last offset", ErrorCodes::LOGICAL_ERROR);
|
||||
size_t nested_limit = last_offset - nested_column.size();
|
||||
@ -341,7 +341,7 @@ static void deserializeTextImpl(IColumn & column, ReadBuffer & istr, Reader && r
|
||||
throw;
|
||||
}
|
||||
|
||||
offsets.push_back((offsets.empty() ? 0 : offsets.back()) + size);
|
||||
offsets.push_back(offsets.back() + size);
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ void dumpToArrayColumns(const Counters & counters, DB::IColumn * column_names_,
|
||||
if (column_names)
|
||||
{
|
||||
auto & offsets = column_names->getOffsets();
|
||||
offsets.push_back((offsets.empty() ? 0 : offsets.back()) + size);
|
||||
offsets.push_back(offsets.back() + size);
|
||||
}
|
||||
|
||||
if (column_values)
|
||||
@ -51,7 +51,7 @@ void dumpToArrayColumns(const Counters & counters, DB::IColumn * column_names_,
|
||||
if (!the_same_offsets)
|
||||
{
|
||||
auto & offsets = column_values->getOffsets();
|
||||
offsets.push_back((offsets.empty() ? 0 : offsets.back()) + size);
|
||||
offsets.push_back(offsets.back() + size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ void Settings::dumpToArrayColumns(IColumn * column_names_, IColumn * column_valu
|
||||
if (column_names)
|
||||
{
|
||||
auto & offsets = column_names->getOffsets();
|
||||
offsets.push_back((offsets.empty() ? 0 : offsets.back()) + size);
|
||||
offsets.push_back(offsets.back() + size);
|
||||
}
|
||||
|
||||
/// Nested columns case
|
||||
@ -211,7 +211,7 @@ void Settings::dumpToArrayColumns(IColumn * column_names_, IColumn * column_valu
|
||||
if (column_values && !the_same_offsets)
|
||||
{
|
||||
auto & offsets = column_values->getOffsets();
|
||||
offsets.push_back((offsets.empty() ? 0 : offsets.back()) + size);
|
||||
offsets.push_back(offsets.back() + size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -513,8 +513,7 @@ void MergeTreeReader::fillMissingColumns(Block & res, bool & should_reorder, boo
|
||||
{
|
||||
ColumnPtr offsets_column = offset_columns[offsets_name];
|
||||
DataTypePtr nested_type = typeid_cast<const DataTypeArray &>(*column_to_add.type).getNestedType();
|
||||
size_t nested_rows = offsets_column->empty() ? 0
|
||||
: typeid_cast<const ColumnUInt64 &>(*offsets_column).getData().back();
|
||||
size_t nested_rows = typeid_cast<const ColumnUInt64 &>(*offsets_column).getData().back();
|
||||
|
||||
ColumnPtr nested_column = nested_type->createColumnConstWithDefaultValue(nested_rows)->convertToFullColumnIfConst();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user