A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://clickhouse.com/docs/sql-reference/functions/ext-dict-functions below:

Functions for Working with Dictionaries

Functions for Working with Dictionaries

Note

For dictionaries created with DDL queries, the dict_name parameter must be fully specified, like <database>.<dict_name>. Otherwise, the current database is used.

For information on connecting and configuring dictionaries, see Dictionaries.

dictGet, dictGetOrDefault, dictGetOrNull

Retrieves values from a dictionary.

Arguments

Returned value

ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.

Example for simple key dictionary

Create a text file ext-dict-test.csv containing the following:

The first column is id, the second column is c1.

Configure the dictionary:

Perform the query:

Example for complex key dictionary

Create a text file ext-dict-mult.csv containing the following:

The first column is id, the second is c1, the third is c2.

Configure the dictionary:

Perform the query:

Example for range key dictionary

Input table:

Create the dictionary:

Perform the query:

Result:

See Also

dictHas

Checks whether a key is present in a dictionary.

Arguments

Returned value

dictGetHierarchy

Creates an array, containing all the parents of a key in the hierarchical dictionary.

Syntax

Arguments

Returned value

dictIsIn

Checks the ancestor of a key through the whole hierarchical chain in the dictionary.

Arguments

Returned value

dictGetChildren

Returns first-level children as an array of indexes. It is the inverse transformation for dictGetHierarchy.

Syntax

Arguments

Returned values

Example

Consider the hierarchic dictionary:

First-level children:

dictGetDescendant

Returns all descendants as if dictGetChildren function was applied level times recursively.

Syntax

Arguments

Returned values

Example

Consider the hierarchic dictionary:

All descendants:

First-level descendants:

dictGetAll

Retrieves the attribute values of all nodes that matched each key in a regular expression tree dictionary.

Besides returning values of type Array(T) instead of T, this function behaves similarly to dictGet.

Syntax

Arguments

Returned value

ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.

Example

Consider the following regexp tree dictionary:

Get all matching values:

Get up to 2 matching values:

Other Functions

ClickHouse supports specialized functions that convert dictionary attribute values to a specific data type regardless of the dictionary configuration.

Functions:

All these functions have the OrDefault modification. For example, dictGetDateOrDefault.

Syntax:

Arguments

Returned value

ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4