blob: 241b3a5ccb4b712a4341a2bf24d0f9a4a6957e58 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#pragma once
#include <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,
const std::vector<UInt64> & slots);
}
|