Support for UUID in ODBC dictionaries

This commit is contained in:
The-Alchemist 2018-08-07 15:09:30 -04:00
parent d1a548638f
commit a9b3279265
3 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,7 @@
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypeUUID.h>
#include <Common/typeid_cast.h>
@ -55,6 +56,8 @@ void ExternalResultDescription::init(const Block & sample_block_)
types.push_back(ValueType::Date);
else if (typeid_cast<const DataTypeDateTime *>(type))
types.push_back(ValueType::DateTime);
else if (typeid_cast<const DataTypeUUID *>(type))
types.push_back(ValueType::UUID);
else
throw Exception{"Unsupported type " + type->getName(), ErrorCodes::UNKNOWN_TYPE};

View File

@ -24,7 +24,8 @@ struct ExternalResultDescription
Float64,
String,
Date,
DateTime
DateTime,
UUID
};
Block sample_block;

View File

@ -59,6 +59,8 @@ namespace
case ValueType::String: static_cast<ColumnString &>(column).insert(value.convert<String>()); break;
case ValueType::Date: static_cast<ColumnUInt16 &>(column).insert(UInt16{LocalDate{value.convert<String>()}.getDayNum()}); break;
case ValueType::DateTime: static_cast<ColumnUInt32 &>(column).insert(time_t{LocalDateTime{value.convert<String>()}}); break;
case ValueType::UUID: static_cast<ColumnUInt128 &>(column).insert(value.convert<UInt128>()); break;
}
}