Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
For dictionaries created with DDL queries, the
dict_name parameter must be fully specified, like <database>.<dict_name>. Otherwise, the current database is used.Example dictionaries
The examples in this section make use of the following dictionaries. You can create them in ClickHouse to run the examples for the functions described below.Example dictionary for dictGet\<T\> and dictGet\<T\>OrDefault functions
Example dictionary for dictGet\<T\> and dictGet\<T\>OrDefault functions
Example dictionary for dictGetAll
Example dictionary for dictGetAll
Create a table to store the data for the regexp tree dictionary:Insert data into the table:Create the regexp tree dictionary:
Example range key dictionary
Example range key dictionary
Create the input table:Insert the data into the input table:Create the dictionary:
Example complex key dictionary
Example complex key dictionary
Create the source table:Insert the data into the source table:Create the dictionary:
Example hierarchical dictionary
Example hierarchical dictionary
Create the source table:Insert the data into the source table:Create the dictionary:
dictGet
Introduced in: v18.16.0 Retrieves values from a dictionary. Syntaxdict_name— Name of the dictionary.Stringattr_names— Name of the column of the dictionary, or tuple of column names.StringorTuple(String)id_expr— Key value. An expression returning UInt64/Tuple(T).UInt64orTuple(T)
<null_value> element specified for the attribute in the dictionary configuration.
Examples
Retrieve a single attribute
Query
Response
Query
Response
dictGetAll
Introduced in: v23.5.0 Converts a dictionary attribute value toAll data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetChildren
Introduced in: v21.4.0 Returns first-level children as an array of indexes. It is the inverse transformation for dictGetHierarchy. Syntaxdict_name— Name of the dictionary.Stringkey— Key to be checked.const String
Array(UInt64)
Examples
Get the first-level children of a dictionary
Query
Response
dictGetDate
Introduced in: v1.1.0 Converts a dictionary attribute value toDate data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetDateOrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toDate data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetDateTime
Introduced in: v1.1.0 Converts a dictionary attribute value toDateTime data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetDateTimeOrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toDateTime data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetDescendants
Introduced in: v21.4.0 Returns all descendants as if thedictGetChildren function were applied level times recursively.
Syntax
dict_name— Name of the dictionary.Stringkey— Key to be checked.const Stringlevel— Key to be checked. Hierarchy level. Iflevel = 0returns all descendants to the end.UInt8
Array(UInt64)
Examples
Get the first-level children of a dictionary
Query
Response
dictGetFloat32
Introduced in: v1.1.0 Converts a dictionary attribute value toFloat32 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetFloat32OrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toFloat32 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetFloat64
Introduced in: v1.1.0 Converts a dictionary attribute value toFloat64 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetFloat64OrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toFloat64 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetHierarchy
Introduced in: v1.1.0 Creates an array, containing all the parents of a key in the hierarchical dictionary. Syntaxdict_name— Name of the dictionary.Stringkey— Key value.const String
Array(UInt64)
Examples
Get hierarchy for a key
Query
Response
dictGetIPv4
Introduced in: v1.1.0 Converts a dictionary attribute value toIPv4 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetIPv4OrDefault
Introduced in: v23.1.0 Converts a dictionary attribute value toIPv4 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetIPv6
Introduced in: v23.1.0 Converts a dictionary attribute value toIPv6 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetIPv6OrDefault
Introduced in: v23.1.0 Converts a dictionary attribute value toIPv6 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetInt16
Introduced in: v1.1.0 Converts a dictionary attribute value toInt16 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetInt16OrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toInt16 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetInt32
Introduced in: v1.1.0 Converts a dictionary attribute value toInt32 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetInt32OrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toInt32 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetInt64
Introduced in: v1.1.0 Converts a dictionary attribute value toInt64 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetInt64OrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toInt64 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetInt8
Introduced in: v1.1.0 Converts a dictionary attribute value toInt8 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetInt8OrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toInt8 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetKeys
Introduced in: v25.12.0 Returns the dictionary key(s) whose attribute equals the specified value. This is the inverse of the functiondictGet on a single attribute.
Use setting max_reverse_dictionary_lookup_cache_size_bytes to cap the size of the per-query reverse-lookup cache used by dictGetKeys.
The cache stores serialized key tuples for each attribute value to avoid re-scanning the dictionary within the same query.
The cache is not persistent across queries. When the limit is reached, entries are evicted with LRU.
This is most effective with large dictionaries when the input has low cardinality and the working set fits in the cache. Set to 0 to disable caching.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Attribute to match.Stringvalue_expr— Value to match against the attribute.Expression
value_expr. For multi key dictionaries: an array of tuples of keys whose attribute equals value_expr. If there is no attribute corresponding to value_expr in the dictionary, then an empty array is returned. ClickHouse throws an exception if it cannot parse the value of the attribute or the value cannot be converted to the attribute data type.
Examples
Sample usage
Query
Response
dictGetOrDefault
Introduced in: v18.16.0 Retrieves values from a dictionary, with a default value if the key is not found. Syntaxdict_name— Name of the dictionary.Stringattr_names— Name of the column of the dictionary, or tuple of column names.StringorTuple(String)id_expr— Key value. An expression returning UInt64/Tuple(T).UInt64orTuple(T)default_value— Default value to return if the key is not found. Type must match the attribute’s data type.
id_expr if the key is found.
If the key is not found, returns the default_value provided.
Examples
Get value with default
Query
Response
dictGetOrNull
Introduced in: v21.4.0 Retrieves values from a dictionary, returning NULL if the key is not found. Syntaxdict_name— Name of the dictionary. String literal. -attr_name— Name of the column to retrieve. String literal. -id_expr— Key value. Expression returning dictionary key-type value.
id_expr if the key is found.
If the key is not found, returns NULL.
Examples
Example using the range key dictionary
Query
Response
dictGetString
Introduced in: v1.1.0 Converts a dictionary attribute value toString data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetStringOrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toString data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetUInt16
Introduced in: v1.1.0 Converts a dictionary attribute value toUInt16 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetUInt16OrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toUInt16 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetUInt32
Introduced in: v1.1.0 Converts a dictionary attribute value toUInt32 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetUInt32OrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toUInt32 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetUInt64
Introduced in: v1.1.0 Converts a dictionary attribute value toUInt64 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetUInt64OrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toUInt64 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetUInt8
Introduced in: v1.1.0 Converts a dictionary attribute value toUInt8 data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetUInt8OrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toUInt8 data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetUUID
Introduced in: v1.1.0 Converts a dictionary attribute value toUUID data type regardless of the dictionary configuration.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. An expression returning a dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)
id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictGetUUIDOrDefault
Introduced in: v1.1.0 Converts a dictionary attribute value toUUID data type regardless of the dictionary configuration, or returns the provided default value if the key is not found.
Syntax
dict_name— Name of the dictionary.Stringattr_name— Name of the column of the dictionary.StringorTuple(String)id_expr— Key value. Expression returning dictionary key-type value or tuple value (dictionary configuration dependent).ExpressionorTuple(T)default_value_expr— Value(s) returned if the dictionary does not contain a row with theid_exprkey.ExpressionorTuple(T)
id_expr,
otherwise returns the value passed as the default_value_expr parameter.
ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
Query
Response
dictHas
Introduced in: v1.1.0 Checks whether a key is present in a dictionary. Syntaxdict_name— Name of the dictionary.Stringid_expr— Key valueconst String
1 if the key exists, otherwise 0. UInt8
Examples
Check for the existence of a key in a dictionary
Query
Response
dictIsIn
Introduced in: v1.1.0 Checks the ancestor of a key through the whole hierarchical chain in the dictionary. Syntaxdict_name— Name of the dictionary.Stringchild_id_expr— Key to be checked.Stringancestor_id_expr— Alleged ancestor of thechild_id_exprkey.const String
0 if child_id_expr is not a child of ancestor_id_expr, 1 if child_id_expr is a child of ancestor_id_expr or if child_id_expr is an ancestor_id_expr. UInt8
Examples
Check hierarchical relationship
Query
Response