mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Hierarchical dictionaries performance: continued [#CLICKHOUSE-2144].
This commit is contained in:
parent
d4992da546
commit
e6ba252507
@ -79,14 +79,11 @@ void CacheDictionary::isInImpl(
|
|||||||
|
|
||||||
const auto null_value = std::get<UInt64>(hierarchical_attribute->null_values);
|
const auto null_value = std::get<UInt64>(hierarchical_attribute->null_values);
|
||||||
|
|
||||||
const PaddedPODArray<Key> * current_children = &child_ids;
|
|
||||||
PaddedPODArray<Key> children(size);
|
PaddedPODArray<Key> children(size);
|
||||||
PaddedPODArray<Key> parents(size);
|
PaddedPODArray<Key> parents(child_ids.begin(), child_ids.end());
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
toParent(*current_children, parents);
|
|
||||||
|
|
||||||
size_t out_idx = 0;
|
size_t out_idx = 0;
|
||||||
size_t parents_idx = 0;
|
size_t parents_idx = 0;
|
||||||
size_t new_children_idx = 0;
|
size_t new_children_idx = 0;
|
||||||
@ -124,10 +121,11 @@ void CacheDictionary::isInImpl(
|
|||||||
if (new_children_idx == 0)
|
if (new_children_idx == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/// Will process new children at next loop iteration.
|
/// Transform all children to its parents.
|
||||||
children.resize(new_children_idx);
|
children.resize(new_children_idx);
|
||||||
parents.resize(new_children_idx);
|
parents.resize(new_children_idx);
|
||||||
current_children = &children;
|
|
||||||
|
toParent(children, parents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ void FlatDictionary::isInImpl(
|
|||||||
while (id < loaded_size && id != null_value && id != ancestor_id)
|
while (id < loaded_size && id != null_value && id != ancestor_id)
|
||||||
id = attr[id];
|
id = attr[id];
|
||||||
|
|
||||||
out[row] = id == ancestor_id;
|
out[row] = id != null_value && id == ancestor_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
query_count.fetch_add(rows, std::memory_order_relaxed);
|
query_count.fetch_add(rows, std::memory_order_relaxed);
|
||||||
|
@ -78,7 +78,7 @@ void HashedDictionary::isInImpl(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
out[row] = id == ancestor_id;
|
out[row] = id != null_value && id == ancestor_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
query_count.fetch_add(rows, std::memory_order_relaxed);
|
query_count.fetch_add(rows, std::memory_order_relaxed);
|
||||||
|
@ -21,7 +21,8 @@ void registerFunctionsComparison(FunctionFactory &);
|
|||||||
void registerFunctionsConditional(FunctionFactory &);
|
void registerFunctionsConditional(FunctionFactory &);
|
||||||
void registerFunctionsConversion(FunctionFactory &);
|
void registerFunctionsConversion(FunctionFactory &);
|
||||||
void registerFunctionsDateTime(FunctionFactory &);
|
void registerFunctionsDateTime(FunctionFactory &);
|
||||||
void registerFunctionsDictionaries(FunctionFactory &);
|
void registerFunctionsEmbeddedDictionaries(FunctionFactory &);
|
||||||
|
void registerFunctionsExternalDictionaries(FunctionFactory &);
|
||||||
void registerFunctionsFormatting(FunctionFactory &);
|
void registerFunctionsFormatting(FunctionFactory &);
|
||||||
void registerFunctionsHashing(FunctionFactory &);
|
void registerFunctionsHashing(FunctionFactory &);
|
||||||
void registerFunctionsHigherOrder(FunctionFactory &);
|
void registerFunctionsHigherOrder(FunctionFactory &);
|
||||||
@ -51,7 +52,8 @@ FunctionFactory::FunctionFactory()
|
|||||||
registerFunctionsConditional(*this);
|
registerFunctionsConditional(*this);
|
||||||
registerFunctionsConversion(*this);
|
registerFunctionsConversion(*this);
|
||||||
registerFunctionsDateTime(*this);
|
registerFunctionsDateTime(*this);
|
||||||
registerFunctionsDictionaries(*this);
|
registerFunctionsEmbeddedDictionaries(*this);
|
||||||
|
registerFunctionsExternalDictionaries(*this);
|
||||||
registerFunctionsFormatting(*this);
|
registerFunctionsFormatting(*this);
|
||||||
registerFunctionsHashing(*this);
|
registerFunctionsHashing(*this);
|
||||||
registerFunctionsHigherOrder(*this);
|
registerFunctionsHigherOrder(*this);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
void registerFunctionsDictionaries(FunctionFactory & factory)
|
void registerFunctionsEmbeddedDictionaries(FunctionFactory & factory)
|
||||||
{
|
{
|
||||||
factory.registerFunction<FunctionRegionToCity>();
|
factory.registerFunction<FunctionRegionToCity>();
|
||||||
factory.registerFunction<FunctionRegionToArea>();
|
factory.registerFunction<FunctionRegionToArea>();
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
void registerFunctionsDictionaries(FunctionFactory & factory)
|
void registerFunctionsExternalDictionaries(FunctionFactory & factory)
|
||||||
{
|
{
|
||||||
factory.registerFunction<FunctionDictHas>();
|
factory.registerFunction<FunctionDictHas>();
|
||||||
factory.registerFunction<FunctionDictGetUInt8>();
|
factory.registerFunction<FunctionDictGetUInt8>();
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
# Automatic tests for external dictionaries
|
# Automatic tests for external dictionaries
|
||||||
|
|
||||||
Example:
|
## Prerequisites:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt install python-lxml python-termcolor
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
```
|
```
|
||||||
MYSQL_OPTIONS=--user=root ./run.sh
|
MYSQL_OPTIONS=--user=root ./run.sh
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user