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.
extractKeyValuePairs
Introduced in: v23.4.0 Extracts key-value pairs from any string. The string does not need to be 100% structured in a key value pair format; It can contain noise (e.g. log files). The key-value pair format to be interpreted should be specified via function arguments. A key-value pair consists of a key followed by akey_value_delimiter and a value. Quoted keys and values are also supported. Key value pairs must be separated by pair delimiters.
Syntax
data- String to extract key-value pairs from. String or FixedString.key_value_delimiter- Character to be used as delimiter between the key and the value. Defaults to:. String or FixedString.pair_delimiters- Set of character to be used as delimiters between pairs. Defaults to\space,,and;. String or FixedString.quoting_character- Character to be used as quoting character. Defaults to". String or FixedString.unexpected_quoting_character_strategy- Strategy to handle quoting characters in unexpected places duringread_keyandread_valuephase. Possible values:invalid,acceptandpromote. Invalid will discard key/value and transition back toWAITING_KEYstate. Accept will treat it as a normal character. Promote will transition toREAD_QUOTED_{KEY/VALUE}state and start from next character. The default value isINVALID
- The extracted key-value pairs in a Map(String, String).
str_to_map, mapFromString
Arguments
- None.
extractKeyValuePairsWithEscaping
Introduced in: v23.4.0 Same asextractKeyValuePairs but with escaping support.
Escape sequences supported: \x, \N, \a, \b, \e, \f, \n, \r, \t, \v and \0.
Non standard escape sequences are returned as it is (including the backslash) unless they are one of the following:
\\, ', ", backtick, /, = or ASCII control characters (c <= 31).
This function will satisfy the use case where pre-escaping and post-escaping are not suitable. For instance, consider the following
input string: a: "aaaa\"bbb". The expected output is: a: aaaa\"bbbb.
- Pre-escaping: Pre-escaping it will output:
a: "aaaa"bbb"andextractKeyValuePairswill then output:a: aaaa - Post-escaping:
extractKeyValuePairswill outputa: aaaa\and post-escaping will keep it as it is.
- None.
map
Introduced in: v21.1.0 Creates a value of typeMap(key, value) from key-value pairs.
Syntax
Map(Any, Any)
Examples
Usage example
Query
Response
mapAdd
Introduced in: v20.7.0 Collect all the keys and sum corresponding values. Syntaxarg1[, arg2, ...]— Maps or tuples of two arrays in which items in the first array represent keys, and the second array contains values for each key.Map(K, V)orTuple(Array(T), Array(T))
Map(K, V) or Tuple(Array(T), Array(T))
Examples
With Map type
Query
Response
Query
Response
mapAll
Introduced in: v23.4.0 Tests whether a condition holds for all key-value pairs in a map.mapAll is a higher-order function.
You can pass a lambda function to it as the first argument.
Syntax
func— Lambda function.Lambda functionmap— Map to check.Map(K, V)
1 if all key-value pairs satisfy the condition, 0 otherwise. UInt8
Examples
Usage example
Query
Response
mapApply
Introduced in: v22.3.0 Applies a function to each element of a map. Syntaxfunc— Lambda function.Lambda functionmap— Map to apply function to.Map(K, V)
func for each element. Map(K, V)
Examples
Usage example
Query
Response
mapConcat
Introduced in: v23.4.0 Concatenates multiple maps based on the equality of their keys. If elements with the same key exist in more than one input map, all elements are added to the result map, but only the first one is accessible via operator []. Syntaxmaps— Arbitrarily many maps.Map
Map
Examples
Usage example
Query
Response
mapContainsKey
Introduced in: v21.2.0 Determines if a key is contained in a map. SyntaxmapContains
Arguments
map— Map to search in.Map(K, V)key— Key to search for. Type must match the key type of the map.Any
UInt8
Examples
Usage example
Query
Response
mapContainsKeyLike
Introduced in: v23.4.0 Checks whether map contains keyLIKE specified pattern.
Syntax
map— Map to search in.Map(K, V)pattern— Pattern to match keys against.const String
1 if map contains a key matching pattern, 0 otherwise. UInt8
Examples
Usage example
Query
Response
mapContainsValue
Introduced in: v25.6.0 Determines if a value is contained in a map. Syntaxmap— Map to search in.Map(K, V)value— Value to search for. Type must match the value type of map.Any
1 if the map contains the value, 0 if not. UInt8
Examples
Usage example
Query
Response
mapContainsValueLike
Introduced in: v25.5.0 Checks whether a map contains a valueLIKE the specified pattern.
Syntax
map— Map to search in.Map(K, V)pattern— Pattern to match values against.const String
1 if map contains a value matching pattern, 0 otherwise. UInt8
Examples
Usage example
Query
Response
mapExists
Introduced in: v23.4.0 Tests whether a condition holds for at least one key-value pair in a map.mapExists is a higher-order function.
You can pass a lambda function to it as the first argument.
Syntax
func— Optional. Lambda function.Lambda functionmap— Map to check.Map(K, V)
1 if at least one key-value pair satisfies the condition, 0 otherwise. UInt8
Examples
Usage example
Query
Response
mapExtractKeyLike
Introduced in: v23.4.0 Give a map with string keys and aLIKE pattern, this function returns a map with elements where the key matches the pattern.
Syntax
map— Map to extract from.Map(K, V)pattern— Pattern to match keys against.const String
Map(K, V)
Examples
Usage example
Query
Response
mapExtractValueLike
Introduced in: v25.5.0 Given a map with string values and aLIKE pattern, this function returns a map with elements where the value matches the pattern.
Syntax
map— Map to extract from.Map(K, V)pattern— Pattern to match values against.const String
Map(K, V)
Examples
Usage example
Query
Response
mapFilter
Introduced in: v22.3.0 Filters a map by applying a function to each map element. Syntaxfunc— Lambda function.Lambda functionmap— Map to filter.Map(K, V)
func returns something other than 0. Map(K, V)
Examples
Usage example
Query
Response
mapFromArrays
Introduced in: v23.3.0 Creates a map from an array or map of keys and an array or map of values. The function is a convenient alternative to syntaxCAST([...], 'Map(key_type, value_type)').
Syntax
MAP_FROM_ARRAYS
Arguments
keys— Array or map of keys to create the map from.ArrayorMapvalues— Array or map of values to create the map from.ArrayorMap
Map
Examples
Basic usage
Query
Response
Query
Response
mapKeys
Introduced in: v21.2.0 Returns the keys of a given map. This function can be optimized by enabling settingoptimize_functions_to_subcolumns.
With the setting enabled, the function only reads the keys subcolumn instead of the entire map.
The query SELECT mapKeys(m) FROM table is transformed to SELECT m.keys FROM table.
Syntax
map— Map to extract keys from.Map(K, V)
Array(T)
Examples
Usage example
Query
Response
mapPartialReverseSort
Introduced in: v23.4.0 Sorts the elements of a map in descending order with additional limit argument allowing partial sorting. If the func function is specified, the sorting order is determined by the result of the func function applied to the keys and values of the map. Syntaxfunc— Optional. Lambda function.Lambda functionlimit— Elements in the range[1..limit]are sorted.(U)Int*map— Map to sort.Map(K, V)
Map(K, V)
Examples
Usage example
Query
Response
mapPartialSort
Introduced in: v23.4.0 Sorts the elements of a map in ascending order with additional limit argument allowing partial sorting. If the func function is specified, the sorting order is determined by the result of the func function applied to the keys and values of the map. Syntaxfunc— Optional. Lambda function.Lambda functionlimit— Elements in the range[1..limit]are sorted.(U)Int*map— Map to sort.Map(K, V)
Map(K, V)
Examples
Usage example
Query
Response
mapPopulateSeries
Introduced in: v20.10.0 Fills missing key-value pairs in a map with integer keys. To support extending the keys beyond the largest value, a maximum key can be specified. More specifically, the function returns a map in which the keys form a series from the smallest to the largest key (or max argument if specified) with step size of 1, and corresponding values. If no value is specified for a key, a default value is used as value. In case keys repeat, only the first value (in order of appearance) is associated with the key. Syntaxmap— Map with integer keys.Map((U)Int*, V)keys— Array of keys.Array(T)values— Array of values.Array(T)max— Optional. Maximum key value.Int8orInt16orInt32orInt64orInt128orInt256
Map(K, V) or Tuple(Array(UInt*), Array(Any))
Examples
With Map type
Query
Response
Query
Response
mapReverseSort
Introduced in: v23.4.0 Sorts the elements of a map in descending order. If the func function is specified, the sorting order is determined by the result of the func function applied to the keys and values of the map. Syntaxfunc— Optional. Lambda function.Lambda functionmap— Map to sort.Map(K, V)
Map(K, V)
Examples
Usage example
Query
Response
mapSort
Introduced in: v23.4.0 Sorts the elements of a map in ascending order. If the func function is specified, the sorting order is determined by the result of the func function applied to the keys and values of the map. Syntaxfunc— Optional. Lambda function.Lambda functionmap— Map to sort.Map(K, V)
Map(K, V)
Examples
Usage example
Query
Response
mapSubtract
Introduced in: v20.7.0 Collect all the keys and subtract corresponding values. Syntaxarg1[, arg2, ...]— Maps or tuples of two arrays in which items in the first array represent keys, and the second array contains values for each key.Map(K, V)orTuple(Array(T), Array(T))
Map(K, V) or Tuple(Array(T), Array(T))
Examples
With Map type
Query
Response
Query
Response
mapUpdate
Introduced in: v22.3.0 For two maps, returns the first map with values updated on the values for the corresponding keys in the second map. Syntaxmap1 with values updated from values for the corresponding keys in map2. Map(K, V)
Examples
Basic usage
Query
Response
mapValues
Introduced in: v21.2.0 Returns the values of a given map. This function can be optimized by enabling settingoptimize_functions_to_subcolumns.
With the setting enabled, the function only reads the values subcolumn instead of the entire map.
The query SELECT mapValues(m) FROM table is transformed to SELECT m.values FROM table.
Syntax
map— Map to extract values from.Map(K, V)
Array(T)
Examples
Usage example
Query
Response