From a9b32792654381ea33de4370b143fbef5337d9d2 Mon Sep 17 00:00:00 2001 From: The-Alchemist Date: Tue, 7 Aug 2018 15:09:30 -0400 Subject: [PATCH] Support for UUID in ODBC dictionaries --- dbms/src/Dictionaries/ExternalResultDescription.cpp | 3 +++ dbms/src/Dictionaries/ExternalResultDescription.h | 3 ++- dbms/src/Dictionaries/ODBCBlockInputStream.cpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dbms/src/Dictionaries/ExternalResultDescription.cpp b/dbms/src/Dictionaries/ExternalResultDescription.cpp index 18788606be7..4ac883d1c39 100644 --- a/dbms/src/Dictionaries/ExternalResultDescription.cpp +++ b/dbms/src/Dictionaries/ExternalResultDescription.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -55,6 +56,8 @@ void ExternalResultDescription::init(const Block & sample_block_) types.push_back(ValueType::Date); else if (typeid_cast(type)) types.push_back(ValueType::DateTime); + else if (typeid_cast(type)) + types.push_back(ValueType::UUID); else throw Exception{"Unsupported type " + type->getName(), ErrorCodes::UNKNOWN_TYPE}; diff --git a/dbms/src/Dictionaries/ExternalResultDescription.h b/dbms/src/Dictionaries/ExternalResultDescription.h index f3bfdf14fcc..ff9426ade57 100644 --- a/dbms/src/Dictionaries/ExternalResultDescription.h +++ b/dbms/src/Dictionaries/ExternalResultDescription.h @@ -24,7 +24,8 @@ struct ExternalResultDescription Float64, String, Date, - DateTime + DateTime, + UUID }; Block sample_block; diff --git a/dbms/src/Dictionaries/ODBCBlockInputStream.cpp b/dbms/src/Dictionaries/ODBCBlockInputStream.cpp index 6ecc60c9925..56a829a8923 100644 --- a/dbms/src/Dictionaries/ODBCBlockInputStream.cpp +++ b/dbms/src/Dictionaries/ODBCBlockInputStream.cpp @@ -59,6 +59,8 @@ namespace case ValueType::String: static_cast(column).insert(value.convert()); break; case ValueType::Date: static_cast(column).insert(UInt16{LocalDate{value.convert()}.getDayNum()}); break; case ValueType::DateTime: static_cast(column).insert(time_t{LocalDateTime{value.convert()}}); break; + case ValueType::UUID: static_cast(column).insert(value.convert()); break; + } }