From c3d30fd502d709db485646b54988f19ac2fb9529 Mon Sep 17 00:00:00 2001 From: avogar Date: Mon, 7 Feb 2022 17:07:44 +0300 Subject: [PATCH] Fix comments --- .../Formats/Impl/MsgPackRowInputFormat.cpp | 13 +++++-------- src/Processors/Formats/Impl/MsgPackRowInputFormat.h | 5 +++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Processors/Formats/Impl/MsgPackRowInputFormat.cpp b/src/Processors/Formats/Impl/MsgPackRowInputFormat.cpp index 81effc0aa02..e19067996e7 100644 --- a/src/Processors/Formats/Impl/MsgPackRowInputFormat.cpp +++ b/src/Processors/Formats/Impl/MsgPackRowInputFormat.cpp @@ -236,12 +236,9 @@ static void insertNull(IColumn & column, DataTypePtr type) static void insertUUID(IColumn & column, DataTypePtr /*type*/, const char * value, size_t size) { ReadBufferFromMemory buf(value, size); - UInt64 first, second; - readBinaryBigEndian(first, buf); - readBinaryBigEndian(second, buf); UUID uuid; - uuid.toUnderType().items[0] = first; - uuid.toUnderType().items[1] = second; + readBinaryBigEndian(uuid.toUnderType().items[0], buf); + readBinaryBigEndian(uuid.toUnderType().items[1], buf); assert_cast(column).insertValue(uuid); } @@ -353,8 +350,8 @@ bool MsgPackVisitor::visit_nil() bool MsgPackVisitor::visit_ext(const char * value, uint32_t size) { - uint8_t type = *value; - if (*value == 0x02) + int8_t type = *value; + if (*value == int8_t(MsgPackExtensionTypes::UUID)) { insertUUID(info_stack.top().column, info_stack.top().type, value + 1, size - 1); return true; @@ -497,7 +494,7 @@ DataTypePtr MsgPackSchemaReader::getDataType(const msgpack::object & object) case msgpack::type::object_type::EXT: { msgpack::object_ext object_ext = object.via.ext; - if (object_ext.type() == 0x02) + if (object_ext.type() == int8_t(MsgPackExtensionTypes::UUID)) return std::make_shared(); throw Exception(ErrorCodes::BAD_ARGUMENTS, "Msgpack extension type {} is not supported", object_ext.type()); } diff --git a/src/Processors/Formats/Impl/MsgPackRowInputFormat.h b/src/Processors/Formats/Impl/MsgPackRowInputFormat.h index 484bc7b3c29..0d25eb4bed0 100644 --- a/src/Processors/Formats/Impl/MsgPackRowInputFormat.h +++ b/src/Processors/Formats/Impl/MsgPackRowInputFormat.h @@ -17,6 +17,11 @@ namespace DB class ReadBuffer; +enum class MsgPackExtensionTypes +{ + UUID = 0x02, +}; + class MsgPackVisitor : public msgpack::null_visitor { public: