2012-08-23 18:05:31 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Columns/IColumnDummy.h>
|
2019-10-27 18:12:40 +00:00
|
|
|
#include <Core/Field.h>
|
2012-08-23 18:05:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2017-01-14 09:00:19 +00:00
|
|
|
class Set;
|
|
|
|
using ConstSetPtr = std::shared_ptr<const Set>;
|
|
|
|
|
|
|
|
|
2017-03-09 04:18:41 +00:00
|
|
|
/** A column containing multiple values in the `IN` section.
|
2017-03-09 00:56:38 +00:00
|
|
|
* Behaves like a constant-column (because the set is one, not its own for each line).
|
|
|
|
* This column has a nonstandard value, so it can not be obtained via a normal interface.
|
2012-08-23 18:05:31 +00:00
|
|
|
*/
|
2019-04-19 20:21:17 +00:00
|
|
|
class ColumnSet final : public COWHelper<IColumnDummy, ColumnSet>
|
2012-08-23 18:05:31 +00:00
|
|
|
{
|
2017-12-14 03:56:56 +00:00
|
|
|
private:
|
2019-04-19 20:21:17 +00:00
|
|
|
friend class COWHelper<IColumnDummy, ColumnSet>;
|
2017-12-14 04:25:22 +00:00
|
|
|
|
2017-12-15 19:17:15 +00:00
|
|
|
ColumnSet(size_t s_, const ConstSetPtr & data_) : data(data_) { s = s_; }
|
2017-12-14 03:56:56 +00:00
|
|
|
ColumnSet(const ColumnSet &) = default;
|
2012-08-23 18:05:31 +00:00
|
|
|
|
2017-12-14 03:56:56 +00:00
|
|
|
public:
|
2017-12-07 22:11:51 +00:00
|
|
|
const char * getFamilyName() const override { return "Set"; }
|
2020-06-04 22:02:59 +00:00
|
|
|
TypeIndex getDataType() const override { return TypeIndex::Set; }
|
2017-12-14 03:56:56 +00:00
|
|
|
MutableColumnPtr cloneDummy(size_t s_) const override { return ColumnSet::create(s_, data); }
|
2014-03-12 18:20:03 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
ConstSetPtr getData() const { return data; }
|
2012-08-23 18:05:31 +00:00
|
|
|
|
2019-10-27 18:12:40 +00:00
|
|
|
// Used only for debugging, making it DUMPABLE
|
|
|
|
Field operator[](size_t) const override { return {}; }
|
|
|
|
|
2012-08-23 18:05:31 +00:00
|
|
|
private:
|
2017-04-01 07:20:54 +00:00
|
|
|
ConstSetPtr data;
|
2012-08-23 18:05:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|