#include namespace DB { template void AggregationMethodOneNumber::insertKeyIntoColumns( const AggregationMethodOneNumber::Key & key, std::vector & key_columns, const Sizes & /*key_sizes*/) { ColumnFixedSizeHelper * column; if constexpr (nullable) { ColumnNullable & nullable_col = assert_cast(*key_columns[0]); ColumnUInt8 * null_map = assert_cast(&nullable_col.getNullMapColumn()); null_map->insertDefault(); column = static_cast(&nullable_col.getNestedColumn()); } else { column = static_cast(key_columns[0]); } static_assert(sizeof(FieldType) <= sizeof(Key)); const auto * key_holder = reinterpret_cast(&key); if constexpr (sizeof(FieldType) < sizeof(Key) && std::endian::native == std::endian::big) column->insertRawData(key_holder + (sizeof(Key) - sizeof(FieldType))); else column->insertRawData(key_holder); } template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template struct AggregationMethodOneNumber; template void AggregationMethodStringNoCache::insertKeyIntoColumns(StringRef key, std::vector & key_columns, const Sizes &) { if constexpr (nullable) { ColumnNullable & column_nullable = assert_cast(*key_columns[0]); assert_cast(column_nullable.getNestedColumn()).insertData(key.data, key.size); column_nullable.getNullMapData().push_back(0); } else { assert_cast(*key_columns[0]).insertData(key.data, key.size); } } template struct AggregationMethodStringNoCache; template struct AggregationMethodStringNoCache; template struct AggregationMethodStringNoCache; template struct AggregationMethodStringNoCache; template void AggregationMethodFixedString::insertKeyIntoColumns(StringRef key, std::vector & key_columns, const Sizes &) { assert_cast(*key_columns[0]).insertData(key.data, key.size); } template struct AggregationMethodFixedString; template struct AggregationMethodFixedString; template struct AggregationMethodFixedString; template void AggregationMethodFixedStringNoCache::insertKeyIntoColumns(StringRef key, std::vector & key_columns, const Sizes &) { if constexpr (nullable) assert_cast(*key_columns[0]).insertData(key.data, key.size); else assert_cast(*key_columns[0]).insertData(key.data, key.size); } template struct AggregationMethodFixedStringNoCache; template struct AggregationMethodFixedStringNoCache; template struct AggregationMethodFixedStringNoCache; template struct AggregationMethodFixedStringNoCache; template void AggregationMethodSingleLowCardinalityColumn::insertKeyIntoColumns( const Key & key, std::vector & key_columns_low_cardinality, const Sizes & /*key_sizes*/) { auto * col = assert_cast(key_columns_low_cardinality[0]); if constexpr (std::is_same_v) col->insertData(key.data, key.size); else col->insertData(reinterpret_cast(&key), sizeof(key)); } template struct AggregationMethodSingleLowCardinalityColumn>; template struct AggregationMethodSingleLowCardinalityColumn>; template struct AggregationMethodSingleLowCardinalityColumn>; template struct AggregationMethodSingleLowCardinalityColumn>; template struct AggregationMethodSingleLowCardinalityColumn>; template struct AggregationMethodSingleLowCardinalityColumn>; template struct AggregationMethodSingleLowCardinalityColumn>; template struct AggregationMethodSingleLowCardinalityColumn>; template struct AggregationMethodSingleLowCardinalityColumn>; template struct AggregationMethodSingleLowCardinalityColumn>; template void AggregationMethodKeysFixed::insertKeyIntoColumns(const Key & key, std::vector & key_columns, const Sizes & key_sizes) { size_t keys_size = key_columns.size(); static constexpr auto bitmap_size = has_nullable_keys ? std::tuple_size>::value : 0; /// In any hash key value, column values to be read start just after the bitmap, if it exists. size_t pos = bitmap_size; for (size_t i = 0; i < keys_size; ++i) { IColumn * observed_column; ColumnUInt8 * null_map; bool column_nullable = false; if constexpr (has_nullable_keys) column_nullable = isColumnNullable(*key_columns[i]); /// If we have a nullable column, get its nested column and its null map. if (column_nullable) { ColumnNullable & nullable_col = assert_cast(*key_columns[i]); observed_column = &nullable_col.getNestedColumn(); null_map = assert_cast(&nullable_col.getNullMapColumn()); } else { observed_column = key_columns[i]; null_map = nullptr; } bool is_null = false; if (column_nullable) { /// The current column is nullable. Check if the value of the /// corresponding key is nullable. Update the null map accordingly. size_t bucket = i / 8; size_t offset = i % 8; UInt8 val = (reinterpret_cast(&key)[bucket] >> offset) & 1; null_map->insertValue(val); is_null = val == 1; } if (has_nullable_keys && is_null) observed_column->insertDefault(); else { size_t size = key_sizes[i]; size_t offset_to = pos; if constexpr (std::endian::native == std::endian::big) offset_to = sizeof(Key) - size - pos; observed_column->insertData(reinterpret_cast(&key) + offset_to, size); pos += size; } } } template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template struct AggregationMethodKeysFixed; template void AggregationMethodSerialized::insertKeyIntoColumns(StringRef key, std::vector & key_columns, const Sizes &) { const auto * pos = key.data; for (auto & column : key_columns) pos = column->deserializeAndInsertFromArena(pos); } template struct AggregationMethodSerialized; template struct AggregationMethodSerialized; template struct AggregationMethodSerialized; // AggregationMethodNullableSerialized template struct AggregationMethodSerialized; template struct AggregationMethodSerialized; template struct AggregationMethodSerialized; // AggregationMethodPreallocSerialized template struct AggregationMethodSerialized; template struct AggregationMethodSerialized; template struct AggregationMethodSerialized; // AggregationMethodNullablePreallocSerialized template struct AggregationMethodSerialized; template struct AggregationMethodSerialized; template struct AggregationMethodSerialized; }