1#pragma once
2
3#include <DataTypes/IDataTypeDummy.h>
4
5
6namespace DB
7{
8
9/** Data type that cannot have any values.
10 * Used to represent NULL of unknown type as Nullable(Nothing),
11 * and possibly for empty array of unknown type as Array(Nothing).
12 */
13class DataTypeNothing final : public IDataTypeDummy
14{
15public:
16 static constexpr bool is_parametric = false;
17
18 const char * getFamilyName() const override { return "Nothing"; }
19 TypeIndex getTypeId() const override { return TypeIndex::Nothing; }
20
21 MutableColumnPtr createColumn() const override;
22
23 /// These methods read and write zero bytes just to allow to figure out size of column.
24 void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const override;
25 void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double avg_value_size_hint) const override;
26
27 bool equals(const IDataType & rhs) const override;
28
29 bool isParametric() const override { return false; }
30 bool textCanContainOnlyValidUTF8() const override { return true; }
31 bool haveMaximumSizeOfValue() const override { return true; }
32 size_t getSizeOfValueInMemory() const override { return 0; }
33 bool canBeInsideNullable() const override { return true; }
34};
35
36}
37