complex_key_hashed

简介: complex_key_hashed

complex_key_hashed 字典在功能方面与 hashed 字典完全相同,只是将单个数值型 key 替换成了复合型。完整示例如下:


/etc/clickhouse-server 目录下新建 test_complex_key_hashed_dictionary.xml 文件,写入如下内容:

<?xml version="1.0"?>
<dictionaries>
  <dictionary>
    <name>test_complex_key_hashed_dict</name>
    <source>
      <!-- 准备好的测试数据 -->
      <file>
        <path>/var/lib/clickhouse/dictionaries_lib/organization.csv</path>
        <format>CSV</format>
      </file>
    </source>
    <layout>
      <complex_key_hashed />
    </layout>
    <!-- 与测试数据的结构对应 -->
    <structure>
      <!-- 复合型key -->
      <key>
        <attribute>
          <name>id</name>
          <type>UInt64</type>
        </attribute>
        <attribute>
          <name>code</name>
          <type>String</type>
        </attribute>
      </key>
      <attribute>
        <name>name</name>
        <type>String</type>
        <null_value></null_value>
      </attribute>
    </structure>
    <lifetime>
      <min>300</min>
      <max>360</max>
    </lifetime>
  </dictionary>
</dictionaries>点击复制复制失败已复制


保存文件,再次查询系统中的所有字典:

$ SELECT name, type, key, attribute.names, attribute.types FROM system.dictionaries;
┌─name─────────────────────────┬─type─┬─key──────────────┬─attribute.names─┬─attribute.types─────┐
│ test_complex_key_hashed_dict │      │ (UInt64, String) │ ['name']        │ ['String']          │
│ test_range_hashed_dict       │      │ UInt64           │ ['price']       │ ['Float32']         │
│ test_hashed_dict             │      │ UInt64           │ ['code','name'] │ ['String','String'] │
│ test_flat_dict               │      │ UInt64           │ ['code','name'] │ ['String','String'] │
│ test_cache_dict              │      │ UInt64           │ ['code','name'] │ ['String','String'] │
└──────────────────────────────┴──────┴──────────────────┴─────────────
目录
相关文章
|
12月前
|
算法 C# C++
Undefined gray values in operator intensity
Undefined gray values in operator intensity
Operator ‘==‘ cannot be applied to ‘int‘, ‘null‘
Operator ‘==‘ cannot be applied to ‘int‘, ‘null‘
|
5月前
|
Scala
【已解决】Specifying keys via field positions is only valid for tuple data types. Type: GenericType<scala
【已解决】Specifying keys via field positions is only valid for tuple data types. Type: GenericType<scala
54 0
|
11月前
|
Java
Leetcode 467. Unique Substrings in Wraparound String
大概翻译下题意,有个无限长的字符串s,是由无数个「abcdefghijklmnopqrstuvwxy」组成的。现在给你一个字符串p,求多少个p的非重复子串在s中出现了?
42 0
HalconDotNet.HTupleAccessException:“‘Cannot convert to double array‘ when accessing ‘HalconDotNet.HT
HalconDotNet.HTupleAccessException:“‘Cannot convert to double array‘ when accessing ‘HalconDotNet.HT
VS2005 error C2864 only static const integral data members can be initialized within a class
VS2005 error C2864 only static const integral data members can be initialized within a class
|
关系型数据库 MySQL C++
类型收窄 error C2397: conversion from ‘const int‘ to ‘char‘ requires a narrowing conversion
类型收窄 error C2397: conversion from ‘const int‘ to ‘char‘ requires a narrowing conversion
162 0
|
PyTorch TensorFlow 算法框架/工具
TensorflowConv2D:AttributeError: ‘int‘ object has no attribute ‘lower‘
TensorflowConv2D:AttributeError: ‘int‘ object has no attribute ‘lower‘
256 0
TensorflowConv2D:AttributeError: ‘int‘ object has no attribute ‘lower‘
TypeError: randint() received an invalid combination of arguments - got (int, int, int), but expecte
TypeError: randint() received an invalid combination of arguments - got (int, int, int), but expecte
640 0
undefined reference to `crypto_get_random'
undefined reference to `crypto_get_random'
78 0