mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 21:51:57 +00:00
4593d363d1
* Fix poor scalability of INSERT into Distributed table [#CLICKHOUSE-2791]. * Fix poor scalability of INSERT into Distributed table (continued) [#CLICKHOUSE-2791]. * Misc [#CLICKHOUSE-2791]. * Fixed error [#CLICKHOUSE-2791].
28 lines
716 B
C++
28 lines
716 B
C++
#pragma once
|
|
|
|
#include <DB/Columns/IColumn.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/** Create a 'selector' to be used in IColumn::scatter method
|
|
* according to sharding scheme and values of column with sharding key.
|
|
*
|
|
* Each of num_shards has its weight. Weight must be small.
|
|
* 'slots' contains weight elements for each shard, in total - sum of all weight elements.
|
|
*
|
|
* Values of column get divided to sum_weight, and modulo of division
|
|
* will map to corresponding shard through 'slots' array.
|
|
*
|
|
* Column must have integer type.
|
|
* T is type of column elements.
|
|
*/
|
|
template <typename T>
|
|
IColumn::Selector createBlockSelector(
|
|
const IColumn & column,
|
|
size_t num_shards,
|
|
const std::vector<size_t> & slots);
|
|
|
|
}
|