2012-08-13 20:16:06 +00:00
|
|
|
#pragma once
|
2010-05-13 16:13:38 +00:00
|
|
|
|
|
|
|
#include <ostream>
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <DataTypes/IDataType.h>
|
2010-05-13 16:13:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2015-06-09 18:58:18 +00:00
|
|
|
class DataTypeString final : public IDataType
|
2010-05-13 16:13:38 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-04-01 07:20:54 +00:00
|
|
|
using FieldType = String;
|
2017-10-30 02:18:06 +00:00
|
|
|
static constexpr bool is_parametric = false;
|
2020-05-08 14:59:58 +00:00
|
|
|
static constexpr auto type_id = TypeIndex::String;
|
2014-10-28 13:43:22 +00:00
|
|
|
|
2017-07-16 03:05:40 +00:00
|
|
|
const char * getFamilyName() const override
|
|
|
|
{
|
|
|
|
return "String";
|
|
|
|
}
|
|
|
|
|
2020-05-08 14:59:58 +00:00
|
|
|
TypeIndex getTypeId() const override { return type_id; }
|
2018-08-20 15:17:55 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
void serializeBinary(const Field & field, WriteBuffer & ostr) const override;
|
|
|
|
void deserializeBinary(Field & field, ReadBuffer & istr) const override;
|
|
|
|
void serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const override;
|
|
|
|
void deserializeBinary(IColumn & column, ReadBuffer & istr) const override;
|
2016-02-16 16:39:39 +00:00
|
|
|
|
2019-02-19 00:41:24 +00:00
|
|
|
void serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const override;
|
|
|
|
void deserializeBinaryBulk(IColumn & column, ReadBuffer & istr, size_t limit, double avg_value_size_hint) const override;
|
2010-05-13 16:13:38 +00:00
|
|
|
|
2018-06-05 21:39:01 +00:00
|
|
|
void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
|
2019-05-18 21:07:23 +00:00
|
|
|
void deserializeWholeText(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override;
|
2010-05-13 16:13:38 +00:00
|
|
|
|
2018-06-05 21:39:01 +00:00
|
|
|
void serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
|
|
|
|
void deserializeTextEscaped(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override;
|
2010-05-13 16:13:38 +00:00
|
|
|
|
2018-06-05 21:39:01 +00:00
|
|
|
void serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
|
|
|
|
void deserializeTextQuoted(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override;
|
2014-10-28 13:43:22 +00:00
|
|
|
|
2018-06-05 21:39:01 +00:00
|
|
|
void serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
|
|
|
|
void deserializeTextJSON(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override;
|
2016-02-18 11:44:50 +00:00
|
|
|
|
2018-06-08 01:51:55 +00:00
|
|
|
void serializeTextXML(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
|
2010-05-13 16:13:38 +00:00
|
|
|
|
2018-06-05 21:39:01 +00:00
|
|
|
void serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
|
2018-06-08 01:51:55 +00:00
|
|
|
void deserializeTextCSV(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override;
|
2016-02-07 08:42:21 +00:00
|
|
|
|
2019-02-26 14:06:05 +00:00
|
|
|
void serializeProtobuf(const IColumn & column, size_t row_num, ProtobufWriter & protobuf, size_t & value_index) const override;
|
2019-02-19 20:01:31 +00:00
|
|
|
void deserializeProtobuf(IColumn & column, ProtobufReader & protobuf, bool allow_add_row, bool & row_added) const override;
|
2019-01-23 19:41:18 +00:00
|
|
|
|
2017-12-14 03:56:56 +00:00
|
|
|
MutableColumnPtr createColumn() const override;
|
2012-08-13 20:16:06 +00:00
|
|
|
|
2019-10-04 17:46:36 +00:00
|
|
|
Field getDefault() const override;
|
2017-12-09 06:32:22 +00:00
|
|
|
|
2017-12-23 01:05:29 +00:00
|
|
|
bool equals(const IDataType & rhs) const override;
|
|
|
|
|
2017-12-09 06:32:22 +00:00
|
|
|
bool isParametric() const override { return false; }
|
|
|
|
bool haveSubtypes() const override { return false; }
|
2018-06-03 16:51:31 +00:00
|
|
|
bool isComparable() const override { return true; }
|
2017-12-09 06:32:22 +00:00
|
|
|
bool canBeComparedWithCollation() const override { return true; }
|
|
|
|
bool isValueUnambiguouslyRepresentedInContiguousMemoryRegion() const override { return true; }
|
|
|
|
bool isCategorial() const override { return true; }
|
|
|
|
bool canBeInsideNullable() const override { return true; }
|
2018-11-23 16:09:07 +00:00
|
|
|
bool canBeInsideLowCardinality() const override { return true; }
|
2010-05-13 16:13:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|