1#pragma once
2#include <Processors/ISimpleTransform.h>
3#include <DataStreams/SizeLimits.h>
4#include <Core/ColumnNumbers.h>
5#include <Interpreters/SetVariants.h>
6
7namespace DB
8{
9
10class DistinctTransform : public ISimpleTransform
11{
12public:
13 DistinctTransform(
14 const Block & header_,
15 const SizeLimits & set_size_limits_,
16 UInt64 limit_hint_,
17 const Names & columns_);
18
19 String getName() const override { return "DistinctTransform"; }
20
21protected:
22 void transform(Chunk & chunk) override;
23
24private:
25 ColumnNumbers key_columns_pos;
26 SetVariants data;
27 Sizes key_sizes;
28 UInt64 limit_hint;
29
30 bool no_more_rows = false;
31
32 /// Restrictions on the maximum size of the output data.
33 SizeLimits set_size_limits;
34
35 template <typename Method>
36 void buildFilter(
37 Method & method,
38 const ColumnRawPtrs & key_columns,
39 IColumn::Filter & filter,
40 size_t rows,
41 SetVariants & variants) const;
42};
43
44}
45