| 1 | #pragma once |
| 2 | |
| 3 | #include <DataTypes/DataTypeWithSimpleSerialization.h> |
| 4 | #include <Core/Field.h> |
| 5 | |
| 6 | |
| 7 | namespace DB |
| 8 | { |
| 9 | |
| 10 | namespace ErrorCodes |
| 11 | { |
| 12 | extern const int NOT_IMPLEMENTED; |
| 13 | } |
| 14 | |
| 15 | /** The base class for data types that do not support serialization and deserialization, |
| 16 | * but arise only as an intermediate result of the calculations. |
| 17 | * |
| 18 | * That is, this class is used just to distinguish the corresponding data type from the others. |
| 19 | */ |
| 20 | class IDataTypeDummy : public DataTypeWithSimpleSerialization |
| 21 | { |
| 22 | private: |
| 23 | [[noreturn]] void throwNoSerialization() const |
| 24 | { |
| 25 | throw Exception("Serialization is not implemented for data type " + getName(), ErrorCodes::NOT_IMPLEMENTED); |
| 26 | } |
| 27 | |
| 28 | public: |
| 29 | void serializeBinary(const Field &, WriteBuffer &) const override { throwNoSerialization(); } |
| 30 | void deserializeBinary(Field &, ReadBuffer &) const override { throwNoSerialization(); } |
| 31 | void serializeBinary(const IColumn &, size_t, WriteBuffer &) const override { throwNoSerialization(); } |
| 32 | void deserializeBinary(IColumn &, ReadBuffer &) const override { throwNoSerialization(); } |
| 33 | void serializeBinaryBulk(const IColumn &, WriteBuffer &, size_t, size_t) const override { throwNoSerialization(); } |
| 34 | void deserializeBinaryBulk(IColumn &, ReadBuffer &, size_t, double) const override { throwNoSerialization(); } |
| 35 | void serializeText(const IColumn &, size_t, WriteBuffer &, const FormatSettings &) const override { throwNoSerialization(); } |
| 36 | void deserializeText(IColumn &, ReadBuffer &, const FormatSettings &) const override { throwNoSerialization(); } |
| 37 | void serializeProtobuf(const IColumn &, size_t, ProtobufWriter &, size_t &) const override { throwNoSerialization(); } |
| 38 | void deserializeProtobuf(IColumn &, ProtobufReader &, bool, bool &) const override { throwNoSerialization(); } |
| 39 | |
| 40 | MutableColumnPtr createColumn() const override |
| 41 | { |
| 42 | throw Exception("Method createColumn() is not implemented for data type " + getName(), ErrorCodes::NOT_IMPLEMENTED); |
| 43 | } |
| 44 | |
| 45 | Field getDefault() const override |
| 46 | { |
| 47 | throw Exception("Method getDefault() is not implemented for data type " + getName(), ErrorCodes::NOT_IMPLEMENTED); |
| 48 | } |
| 49 | |
| 50 | void insertDefaultInto(IColumn &) const override |
| 51 | { |
| 52 | throw Exception("Method insertDefaultInto() is not implemented for data type " + getName(), ErrorCodes::NOT_IMPLEMENTED); |
| 53 | } |
| 54 | |
| 55 | bool haveSubtypes() const override { return false; } |
| 56 | bool cannotBeStoredInTables() const override { return true; } |
| 57 | }; |
| 58 | |
| 59 | } |
| 60 | |