Welcome to 16892 Developer Community-Open, Learning,Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've created an external cache dictionary which I load on start by setting dictionaries_lazy_load as False. The external dictionary is present in system.dictionaries as follows:

 database ──┬─name─────────────┬─────────────────────────────────uuid─┬─status─┬─origin──────────────────────────────────────────┬─type──┬─key────┬─attribute.names────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─attribute.types───────────────────────────────────────────────────────────────────────────────────────────────────────┬─bytes_allocated─┬─query_count─┬─hit_rate─┬─element_count─┬─load_factor─┬─source──────────────────────────────────────────────────┬─lifetime_min─┬─lifetime_max─┬──loading_start_time─┬─last_successful_update_time─┬─loading_duration─┬─last_exception─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ benchmark │ cacheDictionary  │ 00000000-0000-0000-0000-000000000000 │ LOADED │ /etc/clickhouse-server/benchmark_dictionary.xml │ Cache │ UInt64 │ ['date','integers','filterColumn','ramdom0','ramdom1','ramdom2','ramdom3','ramdom4','ramdom5','ramdom6','ramdom7','ramdom8','ramdom9'] │ ['Date','UInt64','Float64','String','String','String','String','String','String','String','String','String','String'] │        26481680 │           0 │      nan │             0 │           0 │ Executable: cat /var/lib/clickhouse/user_files/test.csv │            0 │            0 │ 2021-01-12 20:50:36 │         2021-01-12 20:50:36 │            0.009 │                                                                                                                                    

but when I run the query SELECT dictGet('benchmark.cacheDictionary', 'random1', toUInt64(64)), I get the error

Received exception from server (version 20.8.3): Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: external dictionary 'benchmark.cacheDictionary' not found.

Any thoughts? I've added the xml code below.

    <yandex>
    <dictionary> 
    <name>cacheDictionary </name> 
    <database>benchmark</database>
    <source>
    <executable>
        <command>cat /var/lib/clickhouse/user_files/test.csv</command>
        <format>CSV</format>   
    </executable>
    </source>
    <layout>
    <cache>
    <size_in_cells>130000</size_in_cells>
    </cache>
    </layout>
    <lifetime>0</lifetime>
    <structure>
        <id>
            <name>referentialKey</name>
        </id>

        <attribute>
            <name>date</name>
            <type>Date</type>
            <null_value></null_value>
        </attribute>
        <attribute>
            <name>integers</name>
            <type>UInt64</type>
            <null_value></null_value>
        </attribute>
        <attribute>
            <name>filterColumn</name>
            <type>Float64</type>
            <null_value></null_value>
        </attribute>
        
        <attribute>
            <name>ramdom0</name>
            <type>String</type>
            <null_value></null_value>
        </attribute>
        
        <attribute>
            <name>ramdom1</name>
            <type>String</type>
            <null_value></null_value>
        </attribute>
        
        <attribute>
            <name>ramdom2</name>
            <type>String</type>
            <null_value></null_value>
        </attribute>
        
        <attribute>
            <name>ramdom3</name>
            <type>String</type>
            <null_value></null_value>
        </attribute>
        
        <attribute>
            <name>ramdom4</name>
            <type>String</type>
            <null_value></null_value>
        </attribute>
        
        <attribute>
            <name>ramdom5</name>
            <type>String</type>
            <null_value></null_value>
        </attribute>
        
        <attribute>
            <name>ramdom6</name>
            <type>String</type>
            <null_value></null_value>
        </attribute>
        
        <attribute>
            <name>ramdom7</name>
            <type>String</type>
            <null_value></null_value>
        </attribute>
        
        <attribute>
            <name>ramdom8</name>
            <type>String</type>
            <null_value></null_value>
        </attribute>
        
        <attribute>
            <name>ramdom9</name>
            <type>String</type>
            <null_value></null_value>
        </attribute>
        
    </structure>
    </dictionary>
    </yandex>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.4k views
Welcome To Ask or Share your Answers For Others

1 Answer

XML dictionaries are exists out of database.

XML Dictionary: SELECT dictGet('cacheDictionary'

CREATE Dictionary: SELECT dictGet('benchmark.cacheDictionary'

https://clickhouse.tech/docs/en/sql-reference/functions/ext-dict-functions/#dictget

Attention
dict_name parameter must be fully qualified for
 dictionaries created with DDL queries. Eg. ..*

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to 16892 Developer Community-Open, Learning and Share
...