From 0f73cc3090024c36a37f1b50f40c00b8f2783198 Mon Sep 17 00:00:00 2001 From: millb Date: Wed, 13 Nov 2019 16:38:30 +0300 Subject: [PATCH] Working commit --- dbms/src/Functions/FunctionsHashing.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dbms/src/Functions/FunctionsHashing.h b/dbms/src/Functions/FunctionsHashing.h index 3022e1ce805..b91fad0d89d 100644 --- a/dbms/src/Functions/FunctionsHashing.h +++ b/dbms/src/Functions/FunctionsHashing.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -709,7 +710,7 @@ private: } template - void executeUInt128(const IColumn * column, typename ColumnVector::Container & vec_to) + void executeUUID(const IColumn * column, typename ColumnVector::Container & vec_to) { if (const ColumnUInt128 * col_from = checkAndGetColumn(column)) { @@ -741,7 +742,9 @@ private: size_t size = vec_from.size(); for (size_t i = 0; i < size; ++i) { - String hash_string = toString(vec_from[i]); + WriteBufferFromOwnString buf; + writeText(vec_from[i], vec_from.getScale(), buf); + std::string hash_string = buf.str(); std::cerr << "\n\n" << hash_string << "\n\n"; const ToType h = Impl::apply(reinterpret_cast(&hash_string), hash_string.size()); if (first) @@ -890,7 +893,7 @@ private: else if (which.isDecimal32()) executeIntType>(icolumn, vec_to); else if (which.isDecimal64()) executeIntType>(icolumn, vec_to); else if (which.isDecimal128()) executeDecimal128(icolumn, vec_to); - else if (which.isUUID()) executeUInt128(icolumn, vec_to); + else if (which.isUUID()) executeUUID(icolumn, vec_to); else throw Exception("Unexpected type " + from_type->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);