1#pragma once
2#include <Processors/ISimpleTransform.h>
3#include <Common/HashTable/HashMap.h>
4#include <Common/UInt128.h>
5
6namespace DB
7{
8
9class LimitByTransform : public ISimpleTransform
10{
11public:
12 LimitByTransform(const Block & header, size_t group_length_, size_t group_offset_, const Names & columns);
13
14 String getName() const override { return "LimitByTransform"; }
15
16protected:
17 void transform(Chunk & chunk) override;
18
19private:
20 using MapHashed = HashMap<UInt128, UInt64, UInt128TrivialHash>;
21
22 MapHashed keys_counts;
23 std::vector<size_t> key_positions;
24 const size_t group_length;
25 const size_t group_offset;
26};
27
28}
29