【问题标题】:Array Declaration and Access in External Dictionaries in ClickhouseClickhouse 中的外部字典中的数组声明和访问
【发布时间】:2019-01-06 16:15:09
【问题描述】:

我正在使用 clickhouse 中的外部字典连接到 mongodb。它适用于整数和字符串,但是当涉及到 Array(UInt8) 时,它会给出错误说表不存在

错误:

代码:50,e.displayText() = DB::Exception:未知类型 Array(UInt8),e.what() = DB::Exception

有没有办法在外部字典中声明 Array(UInt8) 作为属性并访问 mongodb 的数组?

【问题讨论】:

    标签: arrays mongodb clickhouse


    【解决方案1】:

    目前不支持对字典使用复合类型。以下是所有支持的类型。

    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};
    }
    

    【讨论】:

      猜你喜欢
      • 2018-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-14
      • 1970-01-01
      • 1970-01-01
      • 2021-09-24
      • 1970-01-01
      相关资源
      最近更新 更多