mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-30 05:30:51 +00:00
dbms: Server: changes to make the code a tad more readable [#METR-19266]
This commit is contained in:
parent
2a0c842966
commit
a4f2f74b8e
@ -131,7 +131,17 @@ static inline T ALWAYS_INLINE packFixed(
|
||||
|
||||
for (size_t j = 0; j < keys_size; ++j)
|
||||
{
|
||||
bool is_null = has_bitmap && (bitmap[j / 8] & (UINT8_C(1) << (j % 8)));
|
||||
bool is_null;
|
||||
|
||||
if (!has_bitmap)
|
||||
is_null = false;
|
||||
else
|
||||
{
|
||||
size_t bucket = j / 8;
|
||||
size_t off = j % 8;
|
||||
is_null = ((bitmap[bucket] >> off) & 1) == 1;
|
||||
}
|
||||
|
||||
if (is_null)
|
||||
continue;
|
||||
|
||||
|
@ -289,7 +289,6 @@ protected:
|
||||
const auto & nullable_col = static_cast<const ColumnNullable &>(*col);
|
||||
actual_columns.push_back(nullable_col.getNestedColumn().get());
|
||||
null_maps.push_back(nullable_col.getNullValuesByteMap().get());
|
||||
has_nullable_columns = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -333,7 +332,6 @@ protected:
|
||||
private:
|
||||
ConstColumnPlainPtrs actual_columns;
|
||||
ConstColumnPlainPtrs null_maps;
|
||||
bool has_nullable_columns = false;
|
||||
};
|
||||
|
||||
/// Case where nullable keys are not supported.
|
||||
@ -422,7 +420,7 @@ struct AggregationMethodKeysFixed
|
||||
{
|
||||
static constexpr auto bitmap_size = has_nullable_keys ? std::tuple_size<KeysNullMap<Key>>::value : 0;
|
||||
/// In any hash key value, column values to be read start just after the bitmap, if it exists.
|
||||
size_t offset = bitmap_size;
|
||||
size_t pos = bitmap_size;
|
||||
|
||||
for (size_t i = 0; i < keys_size; ++i)
|
||||
{
|
||||
@ -449,7 +447,7 @@ struct AggregationMethodKeysFixed
|
||||
/// corresponding key is nullable. Update the null map accordingly.
|
||||
size_t bucket = i / 8;
|
||||
size_t offset = i % 8;
|
||||
bool val = (reinterpret_cast<const char *>(&value.first)[bucket] >> offset) & 1;
|
||||
UInt8 val = (reinterpret_cast<const UInt8 *>(&value.first)[bucket] >> offset) & 1;
|
||||
null_map->insert(val);
|
||||
is_null = val == 1;
|
||||
}
|
||||
@ -461,8 +459,8 @@ struct AggregationMethodKeysFixed
|
||||
else
|
||||
{
|
||||
size_t size = key_sizes[i];
|
||||
observed_column->insertData(reinterpret_cast<const char *>(&value.first) + offset, size);
|
||||
offset += size;
|
||||
observed_column->insertData(reinterpret_cast<const char *>(&value.first) + pos, size);
|
||||
pos += size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1599,7 +1599,11 @@ bool FunctionArrayUniq::execute128bit(
|
||||
{
|
||||
const auto & null_map = static_cast<const ColumnUInt8 &>(*null_maps[i]).getData();
|
||||
if (null_map[j] == 1)
|
||||
bitmap[i / 8] |= UINT8_C(1) << (i % 8);
|
||||
{
|
||||
size_t bucket = i / 8;
|
||||
size_t offset = i % 8;
|
||||
bitmap[bucket] |= UInt8(1) << offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
set.insert(packFixed<UInt128>(j, count, columns, key_sizes, bitmap));
|
||||
@ -1909,7 +1913,11 @@ bool FunctionArrayEnumerateUniq::execute128bit(
|
||||
{
|
||||
const auto & null_map = static_cast<const ColumnUInt8 &>(*null_maps[i]).getData();
|
||||
if (null_map[j] == 1)
|
||||
bitmap[i / 8] |= UINT8_C(1) << (i % 8);
|
||||
{
|
||||
size_t bucket = i / 8;
|
||||
size_t offset = i % 8;
|
||||
bitmap[bucket] |= UInt8(1) << offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
res_values[j] = ++indices[packFixed<UInt128>(j, count, columns, key_sizes, bitmap)];
|
||||
|
Loading…
Reference in New Issue
Block a user