我正在Clickhouse中使用外部字典连接到mongodb。它可以很好地处理整数和字符串,但是当涉及到Array(UInt8)时,它给出错误提示表不存在
错误:
代码:50,e.displayText()= DB :: Exception:未知类型Array(UInt8),e.what()= DB :: Exception
有什么方法可以将Array(UInt8)声明为mongodb的外部字典和访问数组中的属性?
答案 0 :(得分:0)
当前,字典不支持使用复合类型。这是所有受支持的类型。
AttributeUnderlyingType getAttributeUnderlyingType(const std::string & type)
{
static const std::unordered_map<std::string, AttributeUnderlyingType> dictionary{
{ "UInt8", AttributeUnderlyingType::UInt8 },
{ "UInt16", AttributeUnderlyingType::UInt16 },
{ "UInt32", AttributeUnderlyingType::UInt32 },
{ "UInt64", AttributeUnderlyingType::UInt64 },
{ "UUID", AttributeUnderlyingType::UInt128 },
{ "Int8", AttributeUnderlyingType::Int8 },
{ "Int16", AttributeUnderlyingType::Int16 },
{ "Int32", AttributeUnderlyingType::Int32 },
{ "Int64", AttributeUnderlyingType::Int64 },
{ "Float32", AttributeUnderlyingType::Float32 },
{ "Float64", AttributeUnderlyingType::Float64 },
{ "String", AttributeUnderlyingType::String },
{ "Date", AttributeUnderlyingType::UInt16 },
{ "DateTime", AttributeUnderlyingType::UInt32 },
};
const auto it = dictionary.find(type);
if (it != std::end(dictionary))
return it->second;
throw Exception{"Unknown type " + type, ErrorCodes::UNKNOWN_TYPE};
}