mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 19:45:11 +00:00
Fix element_count for HASHED/SPARSE_HASHED with multiple attributes
Previosly element_count was multplied by the number of attributes. Fixes: #5440 Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
93201f21d9
commit
2fd1a73812
@ -761,6 +761,9 @@ void HashedDictionary<dictionary_key_type, sparse, sharded>::blockToAttributes(c
|
||||
auto & attribute = attributes[attribute_index];
|
||||
bool attribute_is_nullable = attribute.is_nullable_sets.has_value();
|
||||
|
||||
/// Number of elements should not take into account multiple attributes.
|
||||
new_element_count = 0;
|
||||
|
||||
getAttributeContainers(attribute_index, [&](auto & containers)
|
||||
{
|
||||
using ContainerType = std::decay_t<decltype(containers.front())>;
|
||||
|
@ -1,2 +1,2 @@
|
||||
0.4768
|
||||
0.4768
|
||||
1000000 0.4768
|
||||
1000000 0.4768
|
||||
|
@ -6,12 +6,12 @@ CREATE TABLE dict_data (key UInt64, v0 UInt16, v1 UInt16, v2 UInt16, v3 UInt16,
|
||||
|
||||
CREATE DICTIONARY dict_sharded (key UInt64, v0 UInt16) PRIMARY KEY key SOURCE(CLICKHOUSE(TABLE 'dict_data')) LIFETIME(MIN 0 MAX 0) LAYOUT(HASHED(SHARDS 32));
|
||||
SYSTEM RELOAD DICTIONARY dict_sharded;
|
||||
SELECT round(load_factor, 4) FROM system.dictionaries WHERE database = currentDatabase() AND name = 'dict_sharded';
|
||||
SELECT element_count, round(load_factor, 4) FROM system.dictionaries WHERE database = currentDatabase() AND name = 'dict_sharded';
|
||||
DROP DICTIONARY dict_sharded;
|
||||
|
||||
CREATE DICTIONARY dict_sharded_multi (key UInt64, v0 UInt16, v1 UInt16, v2 UInt16, v3 UInt16, v4 UInt16) PRIMARY KEY key SOURCE(CLICKHOUSE(TABLE 'dict_data')) LIFETIME(MIN 0 MAX 0) LAYOUT(HASHED(SHARDS 32));
|
||||
SYSTEM RELOAD DICTIONARY dict_sharded_multi;
|
||||
SELECT round(load_factor, 4) FROM system.dictionaries WHERE database = currentDatabase() AND name = 'dict_sharded_multi';
|
||||
SELECT element_count, round(load_factor, 4) FROM system.dictionaries WHERE database = currentDatabase() AND name = 'dict_sharded_multi';
|
||||
DROP DICTIONARY dict_sharded_multi;
|
||||
|
||||
DROP TABLE dict_data;
|
||||
|
Loading…
Reference in New Issue
Block a user