This commit is contained in:
Alexey Milovidov 2020-06-14 07:35:50 +03:00
parent bba0140d8f
commit 44221139e9
3 changed files with 16 additions and 1 deletions

View File

@ -16,13 +16,18 @@ void DataTypeUUID::serializeText(const IColumn & column, size_t row_num, WriteBu
writeText(UUID(assert_cast<const ColumnUInt128 &>(column).getData()[row_num]), ostr); writeText(UUID(assert_cast<const ColumnUInt128 &>(column).getData()[row_num]), ostr);
} }
void DataTypeUUID::deserializeTextEscaped(IColumn & column, ReadBuffer & istr, const FormatSettings &) const void DataTypeUUID::deserializeText(IColumn & column, ReadBuffer & istr, const FormatSettings &) const
{ {
UUID x; UUID x;
readText(x, istr); readText(x, istr);
assert_cast<ColumnUInt128 &>(column).getData().push_back(x); assert_cast<ColumnUInt128 &>(column).getData().push_back(x);
} }
void DataTypeUUID::deserializeTextEscaped(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const
{
deserializeText(column, istr, settings);
}
void DataTypeUUID::serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const void DataTypeUUID::serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
{ {
serializeText(column, row_num, ostr, settings); serializeText(column, row_num, ostr, settings);

View File

@ -17,6 +17,7 @@ public:
bool equals(const IDataType & rhs) const override; bool equals(const IDataType & rhs) const override;
void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override; void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
void deserializeText(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override;
void serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override; 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; void deserializeTextEscaped(IColumn & column, ReadBuffer & istr, const FormatSettings &) const override;
void serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override; void serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
@ -30,6 +31,8 @@ public:
bool canBeUsedInBitOperations() const override { return true; } bool canBeUsedInBitOperations() const override { return true; }
bool canBeInsideNullable() const override { return true; } bool canBeInsideNullable() const override { return true; }
bool canBePromoted() const override { return false; }
}; };
} }

View File

@ -173,6 +173,13 @@ Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const ID
/// We don't need any conversion UInt64 is under type of Date and DateTime /// We don't need any conversion UInt64 is under type of Date and DateTime
return src; return src;
} }
if (which_type.isUUID() && src.getType() == Field::Types::UInt128)
{
/// Already in needed type.
return src;
}
// TODO (vnemkov): extra cases for DateTime64: converting from integer, converting from Decimal // TODO (vnemkov): extra cases for DateTime64: converting from integer, converting from Decimal
} }
else if (which_type.isStringOrFixedString()) else if (which_type.isStringOrFixedString())