mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
stats: development [#CONV-2546].
This commit is contained in:
parent
1ea8120bb0
commit
8eb6ebbbc5
@ -28,13 +28,13 @@ public:
|
|||||||
{
|
{
|
||||||
/// ColumnType::value_type - более узкий тип. Например, UInt8, когда тип Field - UInt64
|
/// ColumnType::value_type - более узкий тип. Например, UInt8, когда тип Field - UInt64
|
||||||
typename ColumnType::value_type x = boost::get<FieldType>(field);
|
typename ColumnType::value_type x = boost::get<FieldType>(field);
|
||||||
ostr.write(reinterpret_cast<const char *>(&x), sizeof(x));
|
writeIntBinary(x, ostr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void deserializeBinary(Field & field, ReadBuffer & istr) const
|
void deserializeBinary(Field & field, ReadBuffer & istr) const
|
||||||
{
|
{
|
||||||
typename ColumnType::value_type x;
|
typename ColumnType::value_type x;
|
||||||
istr.readStrict(reinterpret_cast<char *>(&x), sizeof(x));
|
readIntBinary(x, istr);
|
||||||
field = typename NearestFieldType<FieldType>::Type(x);
|
field = typename NearestFieldType<FieldType>::Type(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,14 @@ static inline void throwReadAfterEOF()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Чтение числа в native формате
|
||||||
|
template <typename T>
|
||||||
|
inline void readIntBinary(T & x, ReadBuffer & buf)
|
||||||
|
{
|
||||||
|
buf.readStrict(reinterpret_cast<char *>(&x), sizeof(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void readChar(char & x, ReadBuffer & buf)
|
inline void readChar(char & x, ReadBuffer & buf)
|
||||||
{
|
{
|
||||||
if (!buf.eof())
|
if (!buf.eof())
|
||||||
|
@ -32,6 +32,14 @@ inline void writeChar(char x, WriteBuffer & buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Запись числа в native формате
|
||||||
|
template <typename T>
|
||||||
|
inline void writeIntBinary(T & x, WriteBuffer & buf)
|
||||||
|
{
|
||||||
|
buf.write(reinterpret_cast<const char *>(&x), sizeof(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void writeIntText(T x, WriteBuffer & buf)
|
void writeIntText(T x, WriteBuffer & buf)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user