1#pragma once
2
3#include <Columns/IColumnDummy.h>
4#include <Core/Field.h>
5
6
7namespace DB
8{
9
10class Set;
11using ConstSetPtr = std::shared_ptr<const Set>;
12
13
14/** A column containing multiple values in the `IN` section.
15 * Behaves like a constant-column (because the set is one, not its own for each line).
16 * This column has a nonstandard value, so it can not be obtained via a normal interface.
17 */
18class ColumnSet final : public COWHelper<IColumnDummy, ColumnSet>
19{
20private:
21 friend class COWHelper<IColumnDummy, ColumnSet>;
22
23 ColumnSet(size_t s_, const ConstSetPtr & data_) : data(data_) { s = s_; }
24 ColumnSet(const ColumnSet &) = default;
25
26public:
27 const char * getFamilyName() const override { return "Set"; }
28 MutableColumnPtr cloneDummy(size_t s_) const override { return ColumnSet::create(s_, data); }
29
30 ConstSetPtr getData() const { return data; }
31
32 // Used only for debugging, making it DUMPABLE
33 Field operator[](size_t) const override { return {}; }
34
35private:
36 ConstSetPtr data;
37};
38
39}
40