ClickHouse/src/DataTypes/IDataTypeDummy.h

60 lines
2.5 KiB
C++
Raw Normal View History

2012-08-23 18:05:31 +00:00
#pragma once
#include <DataTypes/DataTypeWithSimpleSerialization.h>
2019-10-04 17:46:36 +00:00
#include <Core/Field.h>
2012-08-23 18:05:31 +00:00
namespace DB
{
2019-10-04 17:46:36 +00:00
namespace ErrorCodes
{
extern const int NOT_IMPLEMENTED;
}
2017-04-17 11:56:55 +00:00
/** The base class for data types that do not support serialization and deserialization,
* but arise only as an intermediate result of the calculations.
2012-08-23 18:05:31 +00:00
*
2017-04-17 11:56:55 +00:00
* That is, this class is used just to distinguish the corresponding data type from the others.
2012-08-23 18:05:31 +00:00
*/
class IDataTypeDummy : public DataTypeWithSimpleSerialization
2012-08-23 18:05:31 +00:00
{
private:
[[noreturn]] void throwNoSerialization() const
{
throw Exception("Serialization is not implemented for data type " + getName(), ErrorCodes::NOT_IMPLEMENTED);
}
2012-08-23 18:05:31 +00:00
public:
2017-12-01 19:34:51 +00:00
void serializeBinary(const Field &, WriteBuffer &) const override { throwNoSerialization(); }
void deserializeBinary(Field &, ReadBuffer &) const override { throwNoSerialization(); }
void serializeBinary(const IColumn &, size_t, WriteBuffer &) const override { throwNoSerialization(); }
void deserializeBinary(IColumn &, ReadBuffer &) const override { throwNoSerialization(); }
void serializeBinaryBulk(const IColumn &, WriteBuffer &, size_t, size_t) const override { throwNoSerialization(); }
void deserializeBinaryBulk(IColumn &, ReadBuffer &, size_t, double) const override { throwNoSerialization(); }
void serializeText(const IColumn &, size_t, WriteBuffer &, const FormatSettings &) const override { throwNoSerialization(); }
void deserializeText(IColumn &, ReadBuffer &, const FormatSettings &) const override { throwNoSerialization(); }
void serializeProtobuf(const IColumn &, size_t, ProtobufWriter &, size_t &) const override { throwNoSerialization(); }
void deserializeProtobuf(IColumn &, ProtobufReader &, bool, bool &) const override { throwNoSerialization(); }
MutableColumnPtr createColumn() const override
{
throw Exception("Method createColumn() is not implemented for data type " + getName(), ErrorCodes::NOT_IMPLEMENTED);
}
2012-08-23 18:05:31 +00:00
Field getDefault() const override
{
throw Exception("Method getDefault() is not implemented for data type " + getName(), ErrorCodes::NOT_IMPLEMENTED);
}
2017-12-01 19:34:51 +00:00
void insertDefaultInto(IColumn &) const override
{
throw Exception("Method insertDefaultInto() is not implemented for data type " + getName(), ErrorCodes::NOT_IMPLEMENTED);
}
bool haveSubtypes() const override { return false; }
bool cannotBeStoredInTables() const override { return true; }
2012-08-23 18:05:31 +00:00
};
}