mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 22:22:00 +00:00
Merge remote-tracking branch 'upstream/master' into fix25
This commit is contained in:
commit
22a1c1990c
@ -178,11 +178,16 @@ StringRef ColumnArray::serializeValueIntoArena(size_t n, Arena & arena, char con
|
|||||||
char * pos = arena.allocContinue(sizeof(array_size), begin);
|
char * pos = arena.allocContinue(sizeof(array_size), begin);
|
||||||
memcpy(pos, &array_size, sizeof(array_size));
|
memcpy(pos, &array_size, sizeof(array_size));
|
||||||
|
|
||||||
size_t values_size = 0;
|
StringRef res(pos, sizeof(array_size));
|
||||||
for (size_t i = 0; i < array_size; ++i)
|
|
||||||
values_size += getData().serializeValueIntoArena(offset + i, arena, begin).size;
|
|
||||||
|
|
||||||
return StringRef(begin, sizeof(array_size) + values_size);
|
for (size_t i = 0; i < array_size; ++i)
|
||||||
|
{
|
||||||
|
auto value_ref = getData().serializeValueIntoArena(offset + i, arena, begin);
|
||||||
|
res.data = value_ref.data - res.size;
|
||||||
|
res.size += value_ref.size;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,12 +103,13 @@ StringRef ColumnNullable::serializeValueIntoArena(size_t n, Arena & arena, char
|
|||||||
auto pos = arena.allocContinue(s, begin);
|
auto pos = arena.allocContinue(s, begin);
|
||||||
memcpy(pos, &arr[n], s);
|
memcpy(pos, &arr[n], s);
|
||||||
|
|
||||||
size_t nested_size = 0;
|
if (arr[n])
|
||||||
|
return StringRef(pos, s);
|
||||||
|
|
||||||
if (arr[n] == 0)
|
auto nested_ref = getNestedColumn().serializeValueIntoArena(n, arena, begin);
|
||||||
nested_size = getNestedColumn().serializeValueIntoArena(n, arena, begin).size;
|
|
||||||
|
|
||||||
return StringRef{begin, s + nested_size};
|
/// serializeValueIntoArena may reallocate memory. Have to use ptr from nested_ref.data and move it back.
|
||||||
|
return StringRef(nested_ref.data - s, nested_ref.size + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * ColumnNullable::deserializeAndInsertFromArena(const char * pos)
|
const char * ColumnNullable::deserializeAndInsertFromArena(const char * pos)
|
||||||
|
@ -142,11 +142,15 @@ void ColumnTuple::popBack(size_t n)
|
|||||||
|
|
||||||
StringRef ColumnTuple::serializeValueIntoArena(size_t n, Arena & arena, char const *& begin) const
|
StringRef ColumnTuple::serializeValueIntoArena(size_t n, Arena & arena, char const *& begin) const
|
||||||
{
|
{
|
||||||
size_t values_size = 0;
|
StringRef res(begin, 0);
|
||||||
for (auto & column : columns)
|
for (auto & column : columns)
|
||||||
values_size += column->serializeValueIntoArena(n, arena, begin).size;
|
{
|
||||||
|
auto value_ref = column->serializeValueIntoArena(n, arena, begin);
|
||||||
|
res.data = value_ref.data - res.size;
|
||||||
|
res.size += value_ref.size;
|
||||||
|
}
|
||||||
|
|
||||||
return StringRef(begin, values_size);
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * ColumnTuple::deserializeAndInsertFromArena(const char * pos)
|
const char * ColumnTuple::deserializeAndInsertFromArena(const char * pos)
|
||||||
|
@ -300,19 +300,19 @@ StringRef ColumnUnique<ColumnType>::serializeValueIntoArena(size_t n, Arena & ar
|
|||||||
{
|
{
|
||||||
if (is_nullable)
|
if (is_nullable)
|
||||||
{
|
{
|
||||||
const UInt8 null_flag = 1;
|
static constexpr auto s = sizeof(UInt8);
|
||||||
const UInt8 not_null_flag = 0;
|
|
||||||
|
|
||||||
auto pos = arena.allocContinue(sizeof(null_flag), begin);
|
auto pos = arena.allocContinue(s, begin);
|
||||||
auto & flag = (n == getNullValueIndex() ? null_flag : not_null_flag);
|
UInt8 flag = (n == getNullValueIndex() ? 1 : 0);
|
||||||
memcpy(pos, &flag, sizeof(flag));
|
unalignedStore<UInt8>(pos, flag);
|
||||||
|
|
||||||
size_t nested_size = 0;
|
if (n == getNullValueIndex())
|
||||||
|
return StringRef(pos, s);
|
||||||
|
|
||||||
if (n != getNullValueIndex())
|
auto nested_ref = column_holder->serializeValueIntoArena(n, arena, begin);
|
||||||
nested_size = column_holder->serializeValueIntoArena(n, arena, begin).size;
|
|
||||||
|
|
||||||
return StringRef(pos, sizeof(null_flag) + nested_size);
|
/// serializeValueIntoArena may reallocate memory. Have to use ptr from nested_ref.data and move it back.
|
||||||
|
return StringRef(nested_ref.data - s, nested_ref.size + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
return column_holder->serializeValueIntoArena(n, arena, begin);
|
return column_holder->serializeValueIntoArena(n, arena, begin);
|
||||||
|
@ -46,8 +46,6 @@
|
|||||||
<value>uniqCombined(16)</value>
|
<value>uniqCombined(16)</value>
|
||||||
<value>uniqCombined(17)</value>
|
<value>uniqCombined(17)</value>
|
||||||
<value>uniqCombined(18)</value>
|
<value>uniqCombined(18)</value>
|
||||||
<value>uniqCombined(19)</value>
|
|
||||||
<value>uniqCombined(20)</value>
|
|
||||||
<value>uniqUpTo(3)</value>
|
<value>uniqUpTo(3)</value>
|
||||||
<value>uniqUpTo(5)</value>
|
<value>uniqUpTo(5)</value>
|
||||||
<value>uniqUpTo(10)</value>
|
<value>uniqUpTo(10)</value>
|
||||||
|
Loading…
Reference in New Issue
Block a user