From 215cc0a8c1f51cfada9e4b4cfad1a161fa7f72f2 Mon Sep 17 00:00:00 2001 From: Michael Kolupaev Date: Thu, 7 Mar 2013 13:00:40 +0000 Subject: [PATCH] clickhouse: fixed unhex function [#CONV-6788]. --- dbms/include/DB/Functions/FunctionsCoding.h | 4 ++-- dbms/include/DB/Functions/FunctionsFormatting.h | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dbms/include/DB/Functions/FunctionsCoding.h b/dbms/include/DB/Functions/FunctionsCoding.h index 3794415b08b..d9a709e7c9d 100644 --- a/dbms/include/DB/Functions/FunctionsCoding.h +++ b/dbms/include/DB/Functions/FunctionsCoding.h @@ -468,7 +468,7 @@ public: /// Выполнить функцию над блоком. void execute(Block & block, const ColumnNumbers & arguments, size_t result) { - const ColumnPtr column = &*block.getByPosition(arguments[0]).column; + const ColumnPtr column = block.getByPosition(arguments[0]).column; if (const ColumnString * col = dynamic_cast(&*column)) { @@ -520,5 +520,5 @@ public: } } }; - + } diff --git a/dbms/include/DB/Functions/FunctionsFormatting.h b/dbms/include/DB/Functions/FunctionsFormatting.h index 2dbc092fecb..ab021e64552 100644 --- a/dbms/include/DB/Functions/FunctionsFormatting.h +++ b/dbms/include/DB/Functions/FunctionsFormatting.h @@ -34,9 +34,10 @@ public: const IDataType * type = &*arguments[0]; - if (!type->isNumeric() || - dynamic_cast(type) || - dynamic_cast(type)) + if (!dynamic_cast(type) && + !dynamic_cast(type) && + !dynamic_cast(type) && + !dynamic_cast(type)) throw Exception("Cannot format " + type->getName() + " as bitmask string", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); return new DataTypeString;