Fixed hierarchy tests

This commit is contained in:
Maksim Kita 2021-02-18 19:57:20 +03:00
parent 980d171207
commit 2a5a9c6ca4
7 changed files with 6 additions and 55 deletions

View File

@ -142,7 +142,7 @@ void CacheDictionary<dictionary_key_type>::toParent(const PaddedPODArray<UInt64>
out.assign(values.getData());
}
else
throw Exception();
throw Exception("Hierarchy is not supported for complex key CacheDictionary", ErrorCodes::UNSUPPORTED_METHOD);
}
@ -437,6 +437,7 @@ ColumnUInt8::Ptr CacheDictionary<dictionary_key_type>::hasKeys(const Columns & k
DictionaryKeysExtractor<dictionary_key_type> extractor(key_columns);
const auto & keys = extractor.getKeys();
/// We make empty request just to fetch if keys exists
DictionaryStorageFetchRequest request(dict_struct, {});
FetchResult result_of_fetch_from_storage;
@ -702,7 +703,6 @@ void CacheDictionary<dictionary_key_type>::update(CacheDictionaryUpdateUnitPtr<d
const auto & keys = keys_extractor.getKeys();
cache_storage_ptr->insertColumnsForKeys(keys, block_columns);
found_num += keys.size();
for (size_t index_of_attribute = 0; index_of_attribute < update_unit_ptr->fetched_columns_during_update.size(); ++index_of_attribute)
{
@ -715,14 +715,14 @@ void CacheDictionary<dictionary_key_type>::update(CacheDictionaryUpdateUnitPtr<d
}
}
// std::cerr << "CacheDictionary::update fetched keys during update " << std::endl;
for (size_t i = 0; i < keys.size(); ++i)
{
auto fetched_key_from_source = keys[i];
// std::cerr << "Key " << convertKeyToString(fetched_key_from_source) << std::endl;
update_unit_ptr->requested_keys_to_fetched_columns_during_update_index[fetched_key_from_source] = i;
size_t column_offset = found_num;
update_unit_ptr->requested_keys_to_fetched_columns_during_update_index[fetched_key_from_source] = column_offset + i;
}
// std::cerr << std::endl;
found_num += keys.size();
}
stream->readSuffix();

View File

@ -61,7 +61,6 @@ dictGet
1
1
2
dictIsIn
dictGetHierarchy
[1]
[4,2,1]

View File

@ -113,15 +113,6 @@ LAYOUT(CACHE(SIZE_IN_CELLS 10));
SELECT 'Dictionary cache_dictionary_simple_key_hierarchy';
SELECT 'dictGet';
SELECT dictGet('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', 'parent_id', number) FROM system.numbers LIMIT 5;
SELECT 'dictIsIn';
-- SELECT 'Check [1] in [0, 1, 2]';
-- SELECT dictIsIn('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([1])), toUInt64(arrayJoin([0, 1, 2])));
-- SELECT 'Check [2] in [0, 1, 2]';
-- SELECT dictIsIn('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([2])), toUInt64(arrayJoin([0, 1, 2])));
-- SELECT 'Check [3] in [0, 1, 2]';
-- SELECT dictIsIn('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3])), toUInt64(arrayJoin([0, 1, 2])));
-- SELECT 'Check [3, 4] in [0, 1, 2]';
-- SELECT dictIsIn('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3, 4])), toUInt64(arrayJoin([0, 1, 2])));
SELECT 'dictGetHierarchy';
SELECT dictGetHierarchy('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(1));
SELECT dictGetHierarchy('01681_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(4));

View File

@ -53,26 +53,6 @@ dictGet
1
1
2
dictIsIn
Check [1] in [0, 1, 2]
0
1
0
Check [2] in [0, 1, 2]
0
1
1
Check [3] in [0, 1, 2]
0
1
0
Check [3, 4] in [0, 1, 2]
0
1
0
1
1
1
dictGetHierarchy
[1]
[4,2,1]

View File

@ -109,15 +109,6 @@ LAYOUT(CACHE(SIZE_IN_CELLS 10));
SELECT 'Dictionary flat_dictionary_simple_key_hierarchy';
SELECT 'dictGet';
SELECT dictGet('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', 'parent_id', number) FROM system.numbers LIMIT 5;
SELECT 'dictIsIn';
SELECT 'Check [1] in [0, 1, 2]';
SELECT dictIsIn('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([1])), toUInt64(arrayJoin([0, 1, 2])));
SELECT 'Check [2] in [0, 1, 2]';
SELECT dictIsIn('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([2])), toUInt64(arrayJoin([0, 1, 2])));
SELECT 'Check [3] in [0, 1, 2]';
SELECT dictIsIn('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3])), toUInt64(arrayJoin([0, 1, 2])));
SELECT 'Check [3, 4] in [0, 1, 2]';
SELECT dictIsIn('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3, 4])), toUInt64(arrayJoin([0, 1, 2])));
SELECT 'dictGetHierarchy';
SELECT dictGetHierarchy('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(1));
SELECT dictGetHierarchy('01681_database_for_flat_dictionary.flat_dictionary_simple_key_hierarchy', toUInt64(4));

View File

@ -61,7 +61,6 @@ dictGet
1
1
2
dictIsIn
dictGetHierarchy
[1]
[4,2,1]

View File

@ -113,15 +113,6 @@ LAYOUT(SSD_CACHE(BLOCK_SIZE 4096 FILE_SIZE 8192 PATH '/home/maksim-kita/ClickHou
SELECT 'Dictionary cache_dictionary_simple_key_hierarchy';
SELECT 'dictGet';
SELECT dictGet('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', 'parent_id', number) FROM system.numbers LIMIT 5;
SELECT 'dictIsIn';
-- SELECT 'Check [1] in [0, 1, 2]';
-- SELECT dictIsIn('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([1])), toUInt64(arrayJoin([0, 1, 2])));
-- SELECT 'Check [2] in [0, 1, 2]';
-- SELECT dictIsIn('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([2])), toUInt64(arrayJoin([0, 1, 2])));
-- SELECT 'Check [3] in [0, 1, 2]';
-- SELECT dictIsIn('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3])), toUInt64(arrayJoin([0, 1, 2])));
-- SELECT 'Check [3, 4] in [0, 1, 2]';
-- SELECT dictIsIn('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(arrayJoin([3, 4])), toUInt64(arrayJoin([0, 1, 2])));
SELECT 'dictGetHierarchy';
SELECT dictGetHierarchy('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(1));
SELECT dictGetHierarchy('01684_database_for_cache_dictionary.cache_dictionary_simple_key_hierarchy', toUInt64(4));