Functions
FunctionWrapper
Auto generated ClickHouse functions.
BLAKE3(message)
staticmethod
BLAKE3(message)
message— The input string to hash.String
Returns the 32-byte BLAKE3 hash of the input string as a fixed-length string. FixedString(32)
CAST(x, T)
staticmethod
CRC32(s)
staticmethod
CRC32IEEE(s)
staticmethod
CRC64(s)
staticmethod
DATE(expr)
staticmethod
FQDN()
staticmethod
FQDN()
Returns the fully qualified domain name of the ClickHouse server. String
HMAC(mode, message, key)
staticmethod
IPv4CIDRToRange(ipv4, cidr)
staticmethod
IPv4CIDRToRange(ipv4, cidr)
Returns a tuple with two IPv4 addresses representing the subnet range. Tuple(IPv4, IPv4)
IPv4NumToString(num)
staticmethod
IPv4NumToStringClassC(num)
staticmethod
IPv4StringToNum(string)
staticmethod
IPv4StringToNumOrDefault(string)
staticmethod
IPv4StringToNumOrNull(string)
staticmethod
IPv4StringToNumOrNull(string)
string— IPv4 address string.String
Returns the IPv4 address, or NULL if invalid. Nullable(UInt32)
IPv4ToIPv6(x)
staticmethod
IPv6CIDRToRange(ipv6, cidr)
staticmethod
IPv6CIDRToRange(ipv6, cidr)
Returns a tuple with two IPv6 addresses representing the subnet range. Tuple(IPv6, IPv6)
IPv6NumToString(x)
staticmethod
IPv6NumToString(x)
x— IPv6 address in binary format.FixedString(16)orIPv6
Returns the IPv6 address string in text format. String
IPv6StringToNum(string)
staticmethod
IPv6StringToNum(string)
string— IPv6 address string.String
Returns theIPv6 address in binary format. FixedString(16)
IPv6StringToNumOrDefault(string)
staticmethod
IPv6StringToNumOrDefault(string)
string— IPv6 address string.String
IPv6 address in binary format, or zero-filled FixedString(16) if invalid. FixedString(16)
IPv6StringToNumOrNull(string)
staticmethod
IPv6StringToNumOrNull(string)
string— IPv6 address string.String
Returns IPv6 address in binary format, or NULL if invalid. Nullable(FixedString(16))
JSONAllPaths(json)
staticmethod
JSONAllPaths(json)
json— JSON column.JSON
Returns an array of all paths in the JSON column. Array(String)
JSONAllPathsWithTypes(json)
staticmethod
JSONAllPathsWithTypes(json)
json— JSON column.JSON
Returns a map of all paths and their data types in the JSON column. Map(String, String)
JSONArrayLength(json)
staticmethod
JSONArrayLength(json)
json— String with valid JSON.String
Returns the number of array elements if json is a valid JSON array string, otherwise returns NULL. Nullable(UInt64)
JSONDynamicPaths(json)
staticmethod
JSONDynamicPaths(json)
json— JSON column.JSON
Returns an array of dynamic paths in the JSON column. Array(String)
JSONDynamicPathsWithTypes(json)
staticmethod
JSONDynamicPathsWithTypes(json)
json— JSON column.JSON
Returns a map of dynamic paths and their data types in the JSON column. Map(String, String)
JSONExtract(json, indices_or_keys=None, return_type=None)
staticmethod
JSONExtract(json[, indices_or_keys, ...], return_type)
json— JSON string to parse.Stringindices_or_keys— A list of zero or more arguments each of which can be either string or integer.Stringor(U)Int*return_type— ClickHouse data type to return.String
Returns a value of specified ClickHouse data type if possible, otherwise returns the default value for that type.
JSONExtractArrayRaw(json, indices_or_keys=None)
staticmethod
JSONExtractArrayRaw(json[, indices_or_keys, ...])
json— JSON string to parse.Stringindices_or_keys— A list of zero or more arguments each of which can be either string or integer.Stringor(U)Int*
Returns an array of strings with JSON array elements. If the part is not an array or does not exist, an empty array will be returned. Array(String)
JSONExtractArrayRawCaseInsensitive(json, indices_or_keys=None)
staticmethod
JSONExtractArrayRawCaseInsensitive(json [, indices_or_keys]...)
json— JSON string to parseStringindices_or_keys— Optional. Indices or keys to navigate to the array. Keys use case-insensitive matchingStringor(U)Int*
Returns an array of raw JSON strings. Array(String)
JSONExtractBool(json, indices_or_keys=None)
staticmethod
JSONExtractBoolCaseInsensitive(json, indices_or_keys=None)
staticmethod
JSONExtractBoolCaseInsensitive(json [, indices_or_keys]...)
json— JSON string to parseStringindices_or_keys— Optional. Indices or keys to navigate to the field. Keys use case-insensitive matchingStringor(U)Int*
Returns the extracted boolean value (1 for true, 0 for false), 0 if not found. UInt8
JSONExtractCaseInsensitive(json, indices_or_keys=None, return_type=None)
staticmethod
JSONExtractCaseInsensitive(json [, indices_or_keys...], return_type)
json— JSON string to parseStringindices_or_keys— Optional. Indices or keys to navigate to the field. Keys use case-insensitive matchingStringor(U)Int*return_type— The ClickHouse data type to extractString
Returns the extracted value in the specified data type. Any
JSONExtractFloat(json, indices_or_keys=None)
staticmethod
JSONExtractFloatCaseInsensitive(json, indices_or_keys=None)
staticmethod
JSONExtractFloatCaseInsensitive(json [, indices_or_keys]...)
json— JSON string to parseStringindices_or_keys— Optional. Indices or keys to navigate to the field. Keys use case-insensitive matchingStringor(U)Int*
Returns the extracted Float value, 0 if not found or cannot be converted. Float64
JSONExtractInt(json, indices_or_keys=None)
staticmethod
JSONExtractIntCaseInsensitive(json, indices_or_keys=None)
staticmethod
JSONExtractKeys(json, indices_or_keys=None)
staticmethod
JSONExtractKeys(json[, indices_or_keys, ...])
json— JSON string to parse.Stringindices_or_keys— A list of zero or more arguments each of which can be either string or integer.Stringor(U)Int*
Returns an array with the keys of the JSON object. Array(String)
JSONExtractKeysAndValues(json, indices_or_keys=None, value_type=None)
staticmethod
JSONExtractKeysAndValues(json[, indices_or_keys, ...], value_type)
json— JSON string to parse.Stringindices_or_keys— A list of zero or more arguments each of which can be either string or integer.Stringor(U)Int*value_type— ClickHouse data type of the values.String
Returns an array of tuples with the parsed key-value pairs. Array(Tuple(String, value_type))
JSONExtractKeysAndValuesCaseInsensitive(json, indices_or_keys=None, value_type=None)
staticmethod
JSONExtractKeysAndValuesCaseInsensitive(json [, indices_or_keys...], value_type)
json— JSON string to parseStringindices_or_keys— Optional. Indices or keys to navigate to the object. Keys use case-insensitive matchingStringor(U)Int*value_type— The ClickHouse data type of the valuesString
Returns an array of tuples containing key-value pairs. Array(Tuple(String, T))
JSONExtractKeysAndValuesRaw(json, indices_or_keys=None)
staticmethod
JSONExtractKeysAndValuesRaw(json[, indices_or_keys, ...])
json— JSON string to parse.Stringindices_or_keys— A list of zero or more arguments each of which can be either string or integer.Stringor(U)Int*
Returns an array of tuples with parsed key-value pairs where values are unparsed strings. Array(Tuple(String, String))
JSONExtractKeysAndValuesRawCaseInsensitive(json, indices_or_keys=None)
staticmethod
JSONExtractKeysAndValuesRawCaseInsensitive(json [, indices_or_keys]...)
json— JSON string to parseStringindices_or_keys— Optional. Indices or keys to navigate to the object. Keys use case-insensitive matchingStringor(U)Int*
Returns an array of tuples containing key-value pairs as raw strings. Array(Tuple(String, String))
JSONExtractKeysCaseInsensitive(json, indices_or_keys=None)
staticmethod
JSONExtractKeysCaseInsensitive(json [, indices_or_keys]...)
json— JSON string to parseStringindices_or_keys— Optional. Indices or keys to navigate to the object. Keys use case-insensitive matchingStringor(U)Int*
Returns an array of keys from the JSON object. Array(String)
JSONExtractRaw(json, indices_or_keys=None)
staticmethod
JSONExtractRaw(json[, indices_or_keys, ...])
json— JSON string to parse.Stringindices_or_keys— A list of zero or more arguments each of which can be either string or integer.Stringor(U)Int*
Returns the part of JSON as an unparsed string. If the part does not exist or has a wrong type, an empty string will be returned. String
JSONExtractRawCaseInsensitive(json, indices_or_keys=None)
staticmethod
JSONExtractString(json, indices_or_keys=None)
staticmethod
JSONExtractStringCaseInsensitive(json, indices_or_keys=None)
staticmethod
JSONExtractUInt(json, indices_or_keys=None)
staticmethod
JSONExtractUIntCaseInsensitive(json, indices_or_keys=None)
staticmethod
JSONHas(json, indices_or_keys=None)
staticmethod
JSONKey(json, indices_or_keys=None)
staticmethod
JSONKey(json[, indices_or_keys, ...])
json— JSON string to parse.Stringindices_or_keys— Optional list of indices or keys specifying a path to a nested element. Each argument can be either a string (access by key) or an integer (access by index starting from 1).StringorInt*
Returns the key name at the specified position in the JSON object. String
JSONLength(json, indices_or_keys=None)
staticmethod
JSONLength(json [, indices_or_keys, ...])
json— JSON string to parseString[, indices_or_keys, ...]— Optional. A list of zero or more arguments.Stringor(U)Int8/16/32/64
Returns the length of the JSON array or JSON object, otherwise returns 0 if the value does not exist or has the wrong type. UInt64
JSONMergePatch(json1, json2=None)
staticmethod
JSONSharedDataPaths(json)
staticmethod
JSONSharedDataPaths(json)
json— JSON column.JSON
Returns an array of paths stored in shared data structure in the JSON column. Array(String)
JSONSharedDataPathsWithTypes(json)
staticmethod
JSONSharedDataPathsWithTypes(json)
json— JSON column.JSON
Returns a map of paths stored in shared data structure and their data types in the JSON column. Map(String, String)
JSONType(json, indices_or_keys=None)
staticmethod
JSONType(json[, indices_or_keys, ...])
json— JSON string to parseStringjson[, indices_or_keys, ...]— A list of zero or more arguments, each of which can be either string or integer.Stringor(U)Int8/16/32/64
Returns the type of a JSON value as a string, otherwise if the value doesn't exist it returns Null=0 Enum
JSON_EXISTS(json, path)
staticmethod
JSON_QUERY(json, path)
staticmethod
JSON_VALUE(json, path)
staticmethod
L1Distance(vector1, vector2)
staticmethod
L1Norm(vector)
staticmethod
L1Normalize(tuple)
staticmethod
L1Normalize(tuple)
tuple— A tuple of numeric values.Tuple(T)
Returns the unit vector. Tuple(Float64)
L2Distance(vector1, vector2)
staticmethod
L2DistanceTransposed(vector1, vector2, p)
staticmethod
L2DistanceTransposed(vector1, vector2, p)
vectors— Vectors.QBit(T, UInt64)reference— Reference vector.Array(T)p— Number of bits from each vector element to use in the distance calculation (1 to element bit-width). The quantization level controls the precision-speed trade-off. Using fewer bits results in faster I/O and calculations with reduced accuracy, while using more bits increases accuracy at the cost of performance.UInt
Returns the approximate 2-norm distance. Float64
L2Norm(vector)
staticmethod
L2Norm(vector)
Returns the L2-norm or Euclidean distance. UInt* or Float*
L2Normalize(tuple)
staticmethod
L2Normalize(tuple)
tuple— A tuple of numeric values.Tuple(T)
Returns the unit vector. Tuple(Float64)
L2SquaredDistance(vector1, vector2)
staticmethod
L2SquaredNorm(vector)
staticmethod
LinfDistance(vector1, vector2)
staticmethod
LinfNorm(vector)
staticmethod
LinfNormalize(tuple)
staticmethod
LinfNormalize(tuple)
tuple— A tuple of numeric values.Tuple(T)
Returns the unit vector. Tuple(Float64)
LpDistance(vector1, vector2, p)
staticmethod
LpNorm(vector, p)
staticmethod
LpNormalize(tuple, p)
staticmethod
LpNormalize(tuple, p)
tuple— A tuple of numeric values.Tuple(T)p— The power. Possible values are any number in the range range from[1; inf).UInt*orFloat*
Returns the unit vector. Tuple(Float64)
MACNumToString(num)
staticmethod
MACStringToNum(s)
staticmethod
MACStringToOUI(s)
staticmethod
MD4(s)
staticmethod
MD4(s)
s— The input string to hash.String
Returns the MD4 hash of the given input string as a fixed-length string. FixedString(16)
MD5(s)
staticmethod
MD5(s)
s— The input string to hash.String
Returns the MD5 hash of the given input string as a fixed-length string. FixedString(16)
RIPEMD160(s)
staticmethod
RIPEMD160(s)
s— The input string to hash.String
Returns the RIPEMD160 hash of the given input string as a fixed-length string. FixedString(20)
SHA1(s)
staticmethod
SHA1(s)
s— The input string to hashString
Returns the SHA1 hash of the given input string as a fixed-length string. FixedString(20)
SHA224(s)
staticmethod
SHA224(s)
s— The input value to hash.String
Returns the SHA224 hash of the given input string as a fixed-length string. FixedString(28)
SHA256(s)
staticmethod
SHA256(s)
s— The input string to hash.String
Returns the SHA256 hash of the given input string as a fixed-length string. FixedString(32)
SHA384(s)
staticmethod
SHA384(s)
s— The input string to hash.String
Returns the SHA384 hash of the given input string as a fixed-length string. FixedString(48)
SHA512(s)
staticmethod
SHA512(s)
s— The input string to hashString
Returns the SHA512 hash of the given input string as a fixed-length string. FixedString(64)
SHA512_256(s)
staticmethod
SHA512_256(s)
s— The input string to hash.String
Returns the SHA512_256 hash of the given input string as a fixed-length string. FixedString(32)
ULIDStringToDateTime(ulid, timezone=None)
staticmethod
ULIDStringToDateTime(ulid[, timezone])
ulid— Input ULID.StringorFixedString(26)timezone— Optional. Timezone name for the returned value.String
Timestamp with milliseconds precision. DateTime64(3)
URLHash(url, N=None)
staticmethod
URLHierarchy(url)
staticmethod
URLHierarchy(url)
url— The URL to process.String
Returns an array of progressively longer URLs forming a hierarchy. Array(String)
URLPathHierarchy(url)
staticmethod
URLPathHierarchy(url)
url— The URL to process.String
Returns an array of progressively longer URL path components forming a hierarchy. Array(String)
UTCTimestamp()
staticmethod
UTCTimestamp()
Returns the current date and time at the moment of query analysis. DateTime
UUIDNumToString(binary, variant=None)
staticmethod
UUIDNumToString(binary[, variant])
binary— Binary representation of a UUID.FixedString(16)variant— Variant as specified by RFC4122. 1 =Big-endian(default), 2 =Microsoft.(U)Int*
Returns the UUID as a string. String
UUIDStringToNum(string, variant=1)
staticmethod
UUIDStringToNum(string[, variant = 1])
string— A string or fixed-string of 36 characters)StringorFixedString(36)variant— Variant as specified by RFC4122. 1 =Big-endian(default), 2 =Microsoft.(U)Int*
Returns the binary representation of string. FixedString(16)
UUIDToNum(uuid, variant=1)
staticmethod
UUIDToNum(uuid[, variant = 1])
uuid— UUID.StringorFixedStringvariant— Variant as specified by RFC4122. 1 =Big-endian(default), 2 =Microsoft.(U)Int*
Returns a binary representation of the UUID. FixedString(16)
UUIDv7ToDateTime(uuid, timezone=None)
staticmethod
UUIDv7ToDateTime(uuid[, timezone])
uuid— A UUID version 7.Stringtimezone— Optional. Timezone name for the returned value.String
Returns a timestamp with milliseconds precision. If the UUID is not a valid version 7 UUID, it returns 1970-01-01 00:00:00.000. DateTime64(3)
YYYYMMDDToDate(YYYYMMDD)
staticmethod
YYYYMMDDToDate32(YYYYMMDD)
staticmethod
YYYYMMDDhhmmssToDateTime(YYYYMMDDhhmmss, timezone=None)
staticmethod
YYYYMMDDhhmmssToDateTime64(YYYYMMDDhhmmss, precision=None, timezone=None)
staticmethod
YYYYMMDDhhmmssToDateTime64(YYYYMMDDhhmmss[, precision[, timezone]])
YYYYMMDDhhmmss— Number containing the year, month, day, hour, minute, and second.(U)Int*orFloat*orDecimalprecision— Precision for the fractional part (0-9).UInt8timezone— Timezone name.String
Returns a DateTime64 value from the provided arguments DateTime64
abs(x)
staticmethod
abs(x)
x— Value to get the absolute value of The absolute value ofx
accurateCast(x, T)
staticmethod
accurateCastOrDefault(x, T, default_value=None)
staticmethod
accurateCastOrDefault(x, T[, default_value])
x— A value to convert.AnyT— The target data type name.const Stringdefault_value— Optional. Default value to return if conversion fails.Any
Returns the converted value with the target data type, or the default value if conversion is not possible. Any
accurateCastOrNull(x, T)
staticmethod
acos(x)
staticmethod
acosh(x)
staticmethod
addDate(datetime, interval)
staticmethod
addDate(datetime, interval)
datetime— The date or date with time to whichintervalis added.DateorDate32orDateTimeorDateTime64orStringinterval— Interval to add.Interval
Returns date or date with time obtained by adding interval to datetime. Date or Date32 or DateTime or DateTime64
addDays(datetime, num)
staticmethod
addHours(datetime, num)
staticmethod
addHours(datetime, num)
datetime— Date or date with time to add specified number of hours to.DateorDate32orDateTimeorDateTime64orStringnum— Number of hours to add.(U)Int*orFloat*
Returns datetime plus num hours DateTime or DateTime64(3)
addInterval(interval_1, interval_2)
staticmethod
addInterval(interval_1, interval_2)
interval_1— First interval or tuple of intervals.IntervalorTuple(Interval)interval_2— Second interval to be added.Interval
Returns a tuple of intervals Tuple(Interval)
addMicroseconds(datetime, num)
staticmethod
addMicroseconds(datetime, num)
datetime— Date with time to add specified number of microseconds to.DateTimeorDateTime64orStringnum— Number of microseconds to add.(U)Int*orFloat*
Returns date_time plus num microseconds DateTime64
addMilliseconds(datetime, num)
staticmethod
addMilliseconds(datetime, num)
datetime— Date with time to add specified number of milliseconds to.DateTimeorDateTime64orStringnum— Number of milliseconds to add.(U)Int*orFloat*
Returns datetime plus num milliseconds DateTime64
addMinutes(datetime, num)
staticmethod
addMinutes(datetime, num)
datetime— Date or date with time to add specified number of minutes to.DateorDate32orDateTimeorDateTime64orStringnum— Number of minutes to add.(U)Int*orFloat*
Returns datetime plus num minutes DateTime or DateTime64(3)
addMonths(datetime, num)
staticmethod
addNanoseconds(datetime, num)
staticmethod
addNanoseconds(datetime, num)
datetime— Date with time to add specified number of nanoseconds to.DateTimeorDateTime64orStringnum— Number of nanoseconds to add.(U)Int*orFloat*
Returns datetime plus num nanoseconds DateTime64
addQuarters(datetime, num)
staticmethod
addSeconds(datetime, num)
staticmethod
addSeconds(datetime, num)
datetime— Date or date with time to add specified number of seconds to.DateorDate32orDateTimeorDateTime64orStringnum— Number of seconds to add.(U)Int*orFloat*
Returns datetime plus num seconds DateTime or DateTime64(3)
addTupleOfIntervals(datetime, intervals)
staticmethod
addTupleOfIntervals(datetime, intervals)
datetime— Date or date with time to add intervals to.DateorDate32orDateTimeorDateTime64intervals— Tuple of intervals to add todatetime.Tuple(Interval)
Returns date with added intervals Date or Date32 or DateTime or DateTime64
addWeeks(datetime, num)
staticmethod
addYears(datetime, num)
staticmethod
addressToLine(address_of_binary_instruction)
staticmethod
addressToLine(address_of_binary_instruction)
address_of_binary_instruction— Address of instruction in a running process.UInt64
Returns a source code filename and line number delimited by a colon, for example, /build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199. Returns the name of a binary, if no debug information could be found, otherwise an empty string, if the address is not valid. String
addressToLineWithInlines(address_of_binary_instruction)
staticmethod
addressToLineWithInlines(address_of_binary_instruction)
address_of_binary_instruction— The address of an instruction in a running process.UInt64
Returns an array whose first element is the source code filename and line number delimited by a colon. The second, third, etc. element list inline functions' source code filenames, line numbers and function names. If no debug information could be found, then an array with a single element equal to the name of the binary is returned, otherwise an empty array is returned if the address is not valid. Array(String)
addressToSymbol(address_of_binary_instruction)
staticmethod
aes_decrypt_mysql(mode, ciphertext, key, iv=None)
staticmethod
aes_encrypt_mysql(mode, plaintext, key, iv=None)
staticmethod
aes_encrypt_mysql(mode, plaintext, key[, iv])
mode— Encryption mode.Stringplaintext— Text that should be encrypted.Stringkey— Encryption key. If the key is longer than required bymode, MySQL-specific key folding is performed.Stringiv— Optional. Initialization vector. Only the first 16 bytes are taken into account.String
Ciphertext binary string. String
age(unit, startdate, enddate, timezone=None)
staticmethod
age('unit', startdate, enddate[, timezone])
unit— The type of interval for result.
| Unit | Possible values |
|---|---|
| nanosecond | nanosecond, nanoseconds, ns |
| microsecond | microsecond, microseconds, us, u |
| millisecond | millisecond, milliseconds, ms |
| second | second, seconds, ss, s |
| minute | minute, minutes, mi, n |
| hour | hour, hours, hh, h |
| day | day, days, dd, d |
| week | week, weeks, wk, ww |
| month | month, months, mm, m |
| quarter | quarter, quarters, qq, q |
| year | year, years, yyyy, yy |
- startdate — The first time value to subtract (the subtrahend). Date or Date32 or DateTime or DateTime64 |
|
- enddate — The second time value to subtract from (the minuend). Date or Date32 or DateTime or DateTime64 |
|
- timezone — Optional. Timezone name. If specified, it is applied to both startdate and enddate. If not specified, timezones of startdate and enddate are used. If they are not the same, the result is unspecified. String |
Returns the difference between enddate and startdate expressed in unit. Int32
aggThrow(throw_prob)
staticmethod
aggThrow(throw_prob)
throw_prob— Probability to throw on creation.Float64
Returns an exception: Code: 503. DB::Exception: Aggregate function aggThrow has thrown exception successfully.
alphaTokens(s, max_substrings=None)
staticmethod
alphaTokens(s[, max_substrings])
s— The string to split.Stringmax_substrings— Optional. Whenmax_substrings > 0, the number of returned substrings will be no more thanmax_substrings, otherwise the function will return as many substrings as possible.Int64
Returns an array of selected substrings of s. Array(String)
analysisOfVariance(val, group_no)
staticmethod
and_(val1, val2)
staticmethod
and(val1, val2[, ...])
val1, val2[, ...]— List of at least two values.Nullable((U)Int*)orNullable(Float*)
Returns:
- 0, if at least one argument evaluates to false
- NULL, if no argument evaluates to false and at least one argument is NULL
- 1, otherwise
Nullable(UInt8)
any(column)
staticmethod
anyHeavy(column)
staticmethod
anyLast(column)
staticmethod
anyLast_respect_nulls(*args)
staticmethod
any_respect_nulls(*args)
staticmethod
appendTrailingCharIfAbsent(s, c)
staticmethod
approx_top_k(N, reserved=None)
staticmethod
approx_top_sum(N, reserved=None)
staticmethod
approx_top_sum(N[, reserved])(column, weight)
column— The name of the column for which to find the most frequent values.Stringweight— The weight. Every value is accountedweighttimes for frequency calculation.UInt64
Returns an array of the approximately most frequent values and their counts, sorted in descending order of approximate frequency. Array
areaCartesian(object)
staticmethod
areaSpherical(object)
staticmethod
argAndMax(arg, val)
staticmethod
argAndMax(arg, val)
arg— Argument for which to find the maximum value.const Stringval— The maximum value.(U)Int8/16/32/64orFloat*orDateorDateTimeorTuple
Returns a tuple containing the arg value that corresponds to maximum val value and the maximum val value. Tuple
argAndMin(arg, val)
staticmethod
argAndMin(arg, val)
arg— Argument for which to find the minimum value.const Stringval— The minimum value.(U)Int8/16/32/64orFloat*orDateorDateTimeorTuple
Returns a tuple containing the arg value that corresponds to minimum val value and the minimum val value. Tuple
argMax(arg, val)
staticmethod
argMax(arg, val)
arg— Argument for which to find the maximum value.const Stringval— The maximum value.(U)Int8/16/32/64orFloat*orDateorDateTimeorTuple
Returns the arg value that corresponds to maximum val value. Type matches arg type.
argMin(arg, val)
staticmethod
argMin(arg, val)
arg— Argument for which to find the maximum value.const Stringval— The minimum value.(U)Int8/16/32/64orFloat*orDateorDateTimeorTuple
Returns the arg value that corresponds to minimum val value. Type matches arg type.
array(x1, x2=None, xN=None)
staticmethod
array(x1 [, x2, ..., xN])
x1— Constant value of any type T. If only this argument is provided, the array will be of type T. -[, x2, ..., xN]— Additional N constant values sharing a common supertype withx1Returns an array, where 'T' is the smallest common type out of the passed arguments.Array(T)
arrayAUCPR(scores, labels, partial_offsets=None)
staticmethod
arrayAUCPR(scores, labels[, partial_offsets])
cores— Scores prediction model gives.Array((U)Int*)orArray(Float*)labels— Labels of samples, usually 1 for positive sample and 0 for negative sample.Array((U)Int*)orArray(Enum)partial_offsets—- Optional. An
Array(T)of three non-negative integers for calculating a partial area under the PR curve (equivalent to a vertical band of the PR space) instead of the whole AUC. This option is useful for distributed computation of the PR AUC. The array must contain the following elements [higher_partitions_tp,higher_partitions_fp,total_positives].higher_partitions_tp: The number of positive labels in the higher-scored partitions.higher_partitions_fp: The number of negative labels in the higher-scored partitions.total_positives: The total number of positive samples in the entire dataset.
note
When arr_partial_offsets is used, the arr_scores and arr_labels should be only a partition of the entire dataset, containing an interval of scores.
The dataset should be divided into contiguous partitions, where each partition contains the subset of the data whose scores fall within a specific range.
For example:
- One partition could contain all scores in the range [0, 0.5).
- Another partition could contain scores in the range [0.5, 1.0].
Returns area under the precision-recall (PR) curve. Float64
arrayAll(func, x, y1=None, yN=None)
staticmethod
arrayAll(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Array(T)cond1_arr, ...— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns 1 if the lambda function returns true for all elements, 0 otherwise UInt8
arrayAvg(func=None, x=None, y1=None, yN=None)
staticmethod
arrayAvg([func(x[, y1, ..., yN])], source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— Optional. A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Array(T)[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns the average of elements in the source array, or the average of elements of the lambda results if provided. Float64
arrayCompact(arr)
staticmethod
arrayConcat(arr1, arr2=None, arrN=None)
staticmethod
arrayCount(func=None, arr1=None)
staticmethod
arrayCount([func, ] arr1, ...)
func— Optional. Function to apply to each element of the array(s).Lambda functionarr1, ..., arrN— N arrays.Array(T)
Returns the number of elements for which func returns true. Otherwise, returns the number of non-zero elements in the array. UInt32
arrayCumSum(func=None, arr1=None, arr2=None, arrN=None)
staticmethod
arrayCumSum([func,] arr1[, arr2, ... , arrN])
func— Optional. A lambda function to apply to the array elements at each position.Lambda functionarr1— The source array of numeric values.Array(T)[arr2, ..., arrN]— Optional. Additional arrays of the same size, passed as arguments to the lambda function if specified.Array(T)
Returns an array of the partial sums of the elements in the source array. The result type matches the input array's numeric type. Array(T)
arrayCumSumNonNegative(func=None, arr1=None, arr2=None, arrN=None)
staticmethod
arrayCumSumNonNegative([func,] arr1[, arr2, ... , arrN])
func— Optional. A lambda function to apply to the array elements at each position.Lambda functionarr1— The source array of numeric values.Array(T)[arr2, ..., arrN]— Optional. Additional arrays of the same size, passed as arguments to the lambda function if specified.Array(T)
Returns an array of the partial sums of the elements in the source array, with any negative running sum replaced by zero. The result type matches the input array's numeric type. Array(T)
arrayDifference(arr)
staticmethod
arrayDistinct(arr)
staticmethod
arrayDotProduct(v1, v2)
staticmethod
arrayDotProduct(v1, v2)
v1— First vector.Array((U)Int* | Float* | Decimal)orTuple((U)Int* | Float* | Decimal)v2— Second vector.Array((U)Int* | Float* | Decimal)orTuple((U)Int* | Float* | Decimal)
The dot product of the two vectors.
note The return type is determined by the type of the arguments. If Arrays or Tuples contain mixed element types then the result type is the supertype.
arrayElement(arr, n)
staticmethod
arrayElementOrNull(arrays)
staticmethod
arrayEnumerate(arr)
staticmethod
arrayEnumerate(arr)
arr— The array to enumerate.Array
Returns the array [1, 2, 3, ..., length (arr)]. Array(UInt32)
arrayEnumerateDense(arr)
staticmethod
arrayEnumerateDenseRanked(clear_depth, arr, max_array_depth)
staticmethod
arrayEnumerateDenseRanked(clear_depth, arr, max_array_depth)
clear_depth— Enumerate elements at the specified level separately. Must be less than or equal tomax_arr_depth.UInt*arr— N-dimensional array to enumerate.Array(T)max_array_depth— The maximum effective depth. Must be less than or equal to the depth ofarr.UInt*
Returns an array denoting where each element first appears in the source array Array
arrayEnumerateUniq(arr1, arr2=None, arrN=None)
staticmethod
arrayEnumerateUniq(arr1[, arr2, ... , arrN])
arr1— First array to process.Array(T)arr2, ...— Optional. Additional arrays of the same size for tuple uniqueness.Array(UInt32)
Returns an array where each element is the position among elements with the same value or tuple. Array(T)
arrayEnumerateUniqRanked(clear_depth, arr, max_array_depth)
staticmethod
arrayEnumerateUniqRanked(clear_depth, arr, max_array_depth)
clear_depth— Enumerate elements at the specified level separately. Positive integer less than or equal tomax_arr_depth.UInt*arr— N-dimensional array to enumerate.Array(T)max_array_depth— The maximum effective depth. Positive integer less than or equal to the depth ofarr.UInt*
Returns an N-dimensional array the same size as arr with each element showing the position of that element in relation to other elements of the same value. Array(T)
arrayExcept(source, except_)
staticmethod
arrayExists(func, x, y1=None, yN=None)
staticmethod
arrayExists(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Array(T)[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns 1 if the lambda function returns true for at least one element, 0 otherwise UInt8
arrayFill(func, x, y1=None, yN=None)
staticmethod
arrayFill(func(x [, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
func(x [, y1, ..., yN])— A lambda functionfunc(x [, y1, y2, ... yN]) → F(x [, y1, y2, ... yN])which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Lambda function[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns an array Array(T)
arrayFilter(func, x, y1=None, yN=None)
staticmethod
arrayFilter(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])]
func(x[, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Array(T)[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns a subset of the source array Array(T)
arrayFirst(func, x, y1=None, yN=None)
staticmethod
arrayFirst(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y). Lambda function. -source_arr— The source array to process.Array(T). -[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T). Returns the first element of the source array for whichλis true, otherwise returns the default value ofT.
arrayFirstIndex(func, x, y1=None, yN=None)
staticmethod
arrayFirstIndex(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y). Lambda function. -source_arr— The source array to process.Array(T). -[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T). Returns the index of the first element of the source array for whichfuncis true, otherwise returns0UInt32
arrayFirstOrNull(func, x, y1=None, yN=None)
staticmethod
arrayFirstOrNull(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Array(T)[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns the first element of the source array for which func is true, otherwise returns NULL.
arrayFlatten(arr)
staticmethod
arrayFlatten(arr)
arr— A multidimensional array.Array(Array(T))
Returns a flattened array from the multidimensional array Array(T)
arrayFold(λ, acc, x1, x2=None, x3=None, xN=None)
staticmethod
arrayFold(λ(acc, x1 [, x2, x3, ... xN]), arr1 [, arr2, arr3, ... arrN], acc)
λ(x, x1 [, x2, x3, ... xN])— A lambda functionλ(acc, x1 [, x2, x3, ... xN]) → F(acc, x1 [, x2, x3, ... xN])whereFis an operation applied toaccand array values fromxwith the result ofaccre-used.Lambda functionarr1 [, arr2, arr3, ... arrN]— N arrays over which to operate.Array(T)acc— Accumulator value with the same type as the return type of the Lambda function. Returns the finalaccvalue.
arrayIntersect(arr, arr1, arrN)
staticmethod
arrayJaccardIndex(arr_x, arr_y)
staticmethod
arrayJoin(arr)
staticmethod
arrayLast(func, x, y1=None, yN=None)
staticmethod
arrayLast(func(x[, y1, ..., yN]), source[, cond1, ... , condN_arr])
func(x[, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y). Lambda function. -source— The source array to process.Array(T). -[, cond1, ... , condN]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T). Returns the last element of the source array for whichfuncis true, otherwise returns the default value ofT.
arrayLastIndex(func, x, y1=None, yN=None)
staticmethod
arrayLastIndex(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Array(T)[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns the index of the last element of the source array for which func is true, otherwise returns 0 UInt32
arrayLastOrNull(func, x, y1=None, yN=None)
staticmethod
arrayLastOrNull(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
func(x [, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y). Lambda function. -source_arr— The source array to process.Array(T). -[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T). Returns the last element of the source array for whichλis not true, otherwise returnsNULL.
arrayLevenshteinDistance(from_, to)
staticmethod
arrayLevenshteinDistanceWeighted(from_, to, from_weights, to_weights)
staticmethod
arrayLevenshteinDistanceWeighted(from, to, from_weights, to_weights)
from— first array.Array(T). -to— second array.Array(T). -from_weights— weights for the first array.Array((U)Int*|Float*)to_weights— weights for the second array.Array((U)Int*|Float*)
Levenshtein distance between the first and the second arrays with custom weights for each element Float64
arrayMap(func, arr)
staticmethod
arrayMap(func, arr)
func— A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionarr— N arrays to process.Array(T)
Returns an array from the lambda results Array(T)
arrayMax(func=None, x=None, y1=None, yN=None)
staticmethod
arrayMax([func(x[, y1, ..., yN])], source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— Optional. A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Array(T)[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns the maximum element in the source array, or the maximum element of the lambda results if provided.
arrayMin(func=None, x=None, y1=None, yN=None)
staticmethod
arrayMin([func(x[, y1, ..., yN])], source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— Optional. A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Array(T)cond1_arr, ...— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns the minimum element in the source array, or the minimum element of the lambda results if provided.
arrayNormalizedGini(predicted, label)
staticmethod
arrayNormalizedGini(predicted, label)
A tuple containing the Gini coefficients of the predicted values, the Gini coefficient of the normalized values, and the normalized Gini coefficient (= the ratio of the former two Gini coefficients) Tuple(Float64, Float64, Float64)
arrayPartialReverseSort(f=None, arr=None, arr1=None, arrN=None, limit=None)
staticmethod
arrayPartialReverseSort([f,] arr [, arr1, ... ,arrN], limit)
f(arr[, arr1, ... ,arrN])— The lambda function to apply to elements of arrayx.Lambda functionarr— Array to be sorted.Array(T)arr1, ... ,arrN— N additional arrays, in the case whenfaccepts multiple arguments.Array(T)limit— Index value up until which sorting will occur.(U)Int*
Returns an array of the same size as the original array where elements in the range [1..limit] are sorted
in descending order. The remaining elements (limit..N] are in an unspecified order.
arrayPartialShuffle(arr, limit=None, seed=None)
staticmethod
arrayPartialShuffle(arr [, limit[, seed]])
arr— The array to shuffle.Array(T)seed— Optional. The seed to be used with random number generation. If not provided, a random one is used.(U)Int*limit— Optional. The number to limit element swaps to, in the range[1..N].(U)Int*
Array with elements partially shuffled. Array(T)
arrayPartialSort(f=None, arr=None, arr1=None, arrN=None, limit=None)
staticmethod
arrayPartialSort([f,] arr [, arr1, ... ,arrN], limit)
f(arr[, arr1, ... ,arrN])— The lambda function to apply to elements of arrayx.Lambda functionarr— Array to be sorted.Array(T)arr1, ... ,arrN— N additional arrays, in the case whenfaccepts multiple arguments.Array(T)limit— Index value up until which sorting will occur.(U)Int*
Returns an array of the same size as the original array where elements in the range [1..limit] are sorted
in ascending order. The remaining elements (limit..N] are in an unspecified order.
arrayPopBack(arr)
staticmethod
arrayPopFront(arr)
staticmethod
arrayProduct(func=None, x=None, y1=None, yN=None)
staticmethod
arrayProduct([func(x[, y1, ..., yN])], source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— Optional. A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Array(T)[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns the product of elements in the source array, or the product of elements of the lambda results if provided. Float64
arrayPushBack(arr, x)
staticmethod
arrayPushBack(arr, x)
arr— The array for which to add valuexto the end of.Array(T)x—- Single value to add to the end of the array.
Array(T).
note
- Only numbers can be added to an array with numbers, and only strings can be added to an array of strings.
- When adding numbers, ClickHouse automatically sets the type of x for the data type of the array.
- Can be NULL. The function adds a NULL element to an array, and the type of array elements converts to Nullable.
For more information about the types of data in ClickHouse, see Data types.
Returns an array identical to arr but with an additional value x at the end of the array Array(T)
arrayPushFront(arr, x)
staticmethod
arrayPushFront(arr, x)
arr— The array for which to add valuexto the end of.Array(T). -x—- Single value to add to the start of the array.
Array(T).
note
- Only numbers can be added to an array with numbers, and only strings can be added to an array of strings.
- When adding numbers, ClickHouse automatically sets the type of x for the data type of the array.
- Can be NULL. The function adds a NULL element to an array, and the type of array elements converts to Nullable.
For more information about the types of data in ClickHouse, see Data types.
Returns an array identical to arr but with an additional value x at the beginning of the array Array(T)
arrayROCAUC(scores, labels, scale=None, partial_offsets=None)
staticmethod
arrayROCAUC(scores, labels[, scale[, partial_offsets]])
scores— Scores prediction model gives.Array((U)Int*)orArray(Float*)labels— Labels of samples, usually 1 for positive sample and 0 for negative sample.Array((U)Int*)orEnumscale— Optional. Decides whether to return the normalized area. If false, returns the area under the TP (true positives) x FP (false positives) curve instead. Default value: true.Boolpartial_offsets—- An array of four non-negative integers for calculating a partial area under the ROC curve (equivalent to a vertical band of the ROC space) instead of the whole AUC. This option is useful for distributed computation of the ROC AUC. The array must contain the following elements [
higher_partitions_tp,higher_partitions_fp,total_positives,total_negatives]. Array of non-negative Integers. Optional.higher_partitions_tp: The number of positive labels in the higher-scored partitions.higher_partitions_fp: The number of negative labels in the higher-scored partitions.total_positives: The total number of positive samples in the entire dataset.total_negatives: The total number of negative samples in the entire dataset.
note
When arr_partial_offsets is used, the arr_scores and arr_labels should be only a partition of the entire dataset, containing an interval of scores.
The dataset should be divided into contiguous partitions, where each partition contains the subset of the data whose scores fall within a specific range.
For example:
- One partition could contain all scores in the range [0, 0.5).
- Another partition could contain scores in the range [0.5, 1.0].
Returns area under the receiver operating characteristic (ROC) curve. Float64
arrayRandomSample(arr, samples)
staticmethod
arrayReduce(agg_f, arr1, arr2=None, arrN=None)
staticmethod
arrayReduceInRanges(agg_f, ranges, arr1, arr2=None, arrN=None)
staticmethod
arrayReduceInRanges(agg_f, ranges, arr1 [, arr2, ... ,arrN)])
agg_f— The name of the aggregate function to use.Stringranges— The range over which to aggregate. An array of tuples,(i, r)containing the indexifrom which to begin from and the rangerover which to aggregate.Array(T)orTuple(T)arr1 [, arr2, ... ,arrN)]— N arrays as arguments to the aggregate function.Array(T)
Returns an array containing results of the aggregate function over the specified ranges Array(T)
arrayRemove(arr, elem)
staticmethod
arrayRemove(arr, elem)
arr— Array(T) -elem— T Returns a subset of the source arrayArray(T)
arrayResize(arr, size, extender=None)
staticmethod
arrayResize(arr, size[, extender])
arr— Array to resize.Array(T)size— -The new length of the array. Ifsizeis less than the original size of the array, the array is truncated from the right. Ifsizeis larger than the initial size of the array, the array is extended to the right withextendervalues or default values for the data type of the array items.extender— Value to use for extending the array. Can beNULL. An array of lengthsize.Array(T)
arrayReverse(arr)
staticmethod
arrayReverseFill(func, x, y1=None, yN=None)
staticmethod
arrayReverseFill(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Array(T)[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns an array with elements of the source array replaced by the results of the lambda. Array(T)
arrayReverseSort(f=None, arr=None, arr1=None, arrN=None)
staticmethod
arrayReverseSort([f,] arr [, arr1, ... ,arrN)
f(y1[, y2 ... yN])— The lambda function to apply to elements of arrayx. -arr— An array to be sorted.Array(T)-arr1, ..., yN— Optional. N additional arrays, in the case whenfaccepts multiple arguments. Returns the arrayxsorted in descending order if no lambda function is provided, otherwise it returns an array sorted according to the logic of the provided lambda function, and then reversed.Array(T).
arrayReverseSplit(func, x, y1=None, yN=None)
staticmethod
arrayReverseSplit(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Lambda function[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns an array of arrays. Array(Array(T))
arrayRotateLeft(arr, n)
staticmethod
arrayRotateLeft(arr, n)
arr— The array for which to rotate the elements.Array(T). -n— Number of elements to rotate.(U)Int8/16/32/64. An array rotated to the left by the specified number of elementsArray(T)
arrayRotateRight(arr, n)
staticmethod
arrayRotateRight(arr, n)
arr— The array for which to rotate the elements.Array(T). -n— Number of elements to rotate.(U)Int8/16/32/64. An array rotated to the right by the specified number of elementsArray(T)
arrayShiftLeft(arr, n, default=None)
staticmethod
arrayShiftLeft(arr, n[, default])
arr— The array for which to shift the elements.Array(T). -n— Number of elements to shift.(U)Int8/16/32/64. -default— Optional. Default value for new elements. An array shifted to the left by the specified number of elementsArray(T)
arrayShiftRight(arr, n, default=None)
staticmethod
arrayShiftRight(arr, n[, default])
arr— The array for which to shift the elements.Array(T)n— Number of elements to shift.(U)Int8/16/32/64default— Optional. Default value for new elements. An array shifted to the right by the specified number of elementsArray(T)
arrayShuffle(arr, seed=None)
staticmethod
arraySimilarity(from_, to, from_weights, to_weights)
staticmethod
arraySimilarity(from, to, from_weights, to_weights)
from— first arrayArray(T)to— second arrayArray(T)from_weights— weights for the first array.Array((U)Int*|Float*)to_weights— weights for the second array.Array((U)Int*|Float*)
Returns the similarity between 0 and 1 of the two arrays based on the weighted Levenshtein distance Float64
arraySlice(arr, offset, length=None)
staticmethod
arraySlice(arr, offset [, length])
arr— Array to slice.Array(T)offset— Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with1.(U)Int*length— The length of the required slice. If you specify a negative value, the function returns an open slice[offset, array_length - length]. If you omit the value, the function returns the slice[offset, the_end_of_array].(U)Int*
Returns a slice of the array with length elements from the specified offset Array(T)
arraySort(f=None, arr=None, arr1=None, arrN=None)
staticmethod
arraySort([f,] arr [, arr1, ... ,arrN])
f(y1[, y2 ... yN])— The lambda function to apply to elements of arrayx. -arr— An array to be sorted.Array(T)-arr1, ..., yN— Optional. N additional arrays, in the case whenfaccepts multiple arguments. Returns the arrayarrsorted in ascending order if no lambda function is provided, otherwise it returns an array sorted according to the logic of the provided lambda function.Array(T).
arraySplit(func, x, y1=None, yN=None)
staticmethod
arraySplit(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda function. -source_arr— The source array to splitArray(T). -[, cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T). Returns an array of arraysArray(Array(T))
arrayStringConcat(arr, separator=None)
staticmethod
arrayStringConcat(arr[, separator])
arr— The array to concatenate.Array(T)separator— Optional. Separator string. By default an empty string.const String
Returns the concatenated string. String
arraySum(func=None, x=None, y1=None, yN=None)
staticmethod
arraySum([func(x[, y1, ..., yN])], source_arr[, cond1_arr, ... , condN_arr])
func(x[, y1, ..., yN])— Optional. A lambda function which operates on elements of the source array (x) and condition arrays (y).Lambda functionsource_arr— The source array to process.Array(T), cond1_arr, ... , condN_arr]— Optional. N condition arrays providing additional arguments to the lambda function.Array(T)
Returns the sum of elements in the source array, or the sum of elements of the lambda results if provided.
arraySymmetricDifference(arr1, arr2, arrN)
staticmethod
arrayUnion(arr1, arr2, arrN)
staticmethod
arrayUniq(arr1, arr2=None, arrN=None)
staticmethod
arrayUniq(arr1[, arr2, ..., arrN])
arr1— Array for which to count the number of unique elements.Array(T)[, arr2, ..., arrN]— Optional. Additional arrays used to count the number of unique tuples of elements at corresponding positions in multiple arrays.Array(T)
For a single argument returns the number of unique
elements. For multiple arguments returns the number of unique tuples made from
elements at corresponding positions across the arrays.
UInt32
arrayWithConstant(N, x)
staticmethod
arrayZip(arr1, arr2, arrN)
staticmethod
arrayZipUnaligned(arr1, arr2, arrN)
staticmethod
arrayZipUnaligned(arr1, arr2, ..., arrN)
arr1, arr2, ..., arrN— N arrays to combine into a single array.Array(T)
Returns an array with elements from the source arrays grouped in tuples. Data types in the tuple are the same as types of the input arrays and in the same order as arrays are passed. Array(T) or Tuple(T1, T2, ...)
ascii(s)
staticmethod
asin(x)
staticmethod
asinh(x)
staticmethod
assumeNotNull(x)
staticmethod
assumeNotNull(x)
x— The original value of any nullable type.Nullable(T)
Returns the non-nullable value, if the original value was not NULL, otherwise an arbitrary value, if the input value is NULL. Any
atan(x)
staticmethod
atan2(y, x)
staticmethod
atanh(x)
staticmethod
authenticatedUser()
staticmethod
authenticatedUser()
The name of the authenticated user. String
avg(x)
staticmethod
avg2(x1, x2)
staticmethod
avg2(x1, x2])
x1, x2]— Accepts two values for averaging. Returns the average value of the provided arguments, promoted to the largest compatible type.
avgWeighted(x, weight)
staticmethod
bar(x, min, max, width=None)
staticmethod
bar(x, min, max[, width])
x— Size to display.(U)Int*orFloat*orDecimalmin— The minimum value.(U)Int*orFloat*orDecimalmax— The maximum value.(U)Int*orFloat*orDecimalwidth— Optional. The width of the bar in characters. The default is80.const (U)Int*orconst Float*orconst Decimal
Returns a unicode-art bar string. String
base32Decode(encoded)
staticmethod
base32Encode(plaintext)
staticmethod
base32Encode(plaintext)
plaintext— Plaintext to encode.String
Returns a string containing the encoded value of the argument. String or FixedString
base58Decode(encoded)
staticmethod
base58Encode(plaintext)
staticmethod
base64Decode(encoded)
staticmethod
base64Encode(plaintext)
staticmethod
base64URLDecode(encoded)
staticmethod
base64URLEncode(plaintext)
staticmethod
basename(expr)
staticmethod
basename(expr)
expr— A string expression. Backslashes must be escaped.String
Returns the tail of the input string after its last slash or backslash. If the input string ends with a slash or backslash, the function returns an empty string. Returns the original string if there are no slashes or backslashes. String
bech32Decode(address)
staticmethod
bech32Decode(address)
address— A Bech32 string to decode.StringorFixedString
Returns a tuple consisting of (hrp, data) that was used to encode the string. The data is in binary format. Tuple(String, String)
bech32Encode(hrp, data, witver=None)
staticmethod
bech32Encode(hrp, data[, witver])
hrp— A String of1 - 83lowercase characters specifying the "human-readable part" of the code. Usually 'bc' or 'tb'.StringorFixedStringdata— A String of binary data to encode.StringorFixedStringwitver— Optional. The witness version (default = 1). AnUInt*specifying the version of the algorithm to run.0for Bech32 and1or greater for Bech32m.UInt*
Returns a Bech32 address string, consisting of the human-readable part, a separator character which is always '1', and a data part. The length of the string will never exceed 90 characters. If the algorithm cannot generate a valid address from the input, it will return an empty string. String
bin(arg)
staticmethod
bitAnd(a, b)
staticmethod
bitCount(x)
staticmethod
bitCount(x)
Returns the number of bits set to one in x. UInt8.
note
The function does not convert the input value to a larger type (sign extension).
For example: bitCount(toUInt8(-1)) = 8.
bitHammingDistance(x, y)
staticmethod
bitNot(a)
staticmethod
bitOr(a, b)
staticmethod
bitPositionsToArray(arg)
staticmethod
bitPositionsToArray(arg)
arg— An integer value.(U)Int*
Returns an array with the ascendingly ordered positions of 1 bits in the binary representation of the input. Array(UInt64)
bitRotateLeft(a, N)
staticmethod
bitRotateLeft(a, N)
a— A value to rotate.(U)Int8/16/32/64N— The number of positions to rotate left.UInt8/16/32/64
Returns the rotated value with type equal to that of a. (U)Int8/16/32/64
bitRotateRight(a, N)
staticmethod
bitRotateRight(a, N)
a— A value to rotate.(U)Int8/16/32/64N— The number of positions to rotate right.UInt8/16/32/64
Returns the rotated value with type equal to that of a. (U)Int8/16/32/64
bitShiftLeft(a, N)
staticmethod
bitShiftLeft(a, N)
a— A value to shift.(U)Int*orStringorFixedStringN— The number of positions to shift.UInt8/16/32/64
Returns the shifted value with type equal to that of a.
bitShiftRight(a, N)
staticmethod
bitShiftRight(a, N)
a— A value to shift.(U)Int*orStringorFixedStringN— The number of positions to shift.UInt8/16/32/64
Returns the shifted value with type equal to that of a.
bitSlice(s, offset, length=None)
staticmethod
bitSlice(s, offset[, length])
s— The String or Fixed String to slice.StringorFixedStringoffset— Returns the starting bit position (1-based indexing).- Positive values: count from the beginning of the string.
- Negative values: count from the end of the string.
[`(U)Int8/16/32/64`](https://clickhouse.com/docs/sql-reference/data-types/int-uint) or [`Float*`](https://clickhouse.com/docs/sql-reference/data-types/float)length— Optional. The number of bits to extract.- Positive values: extract
lengthbits. - Negative values: extract from the offset to
(string_length - |length|). - Omitted: extract from offset to end of string.
- If length is not a multiple of 8, the result is padded with zeros on the right.
(U)Int8/16/32/64orFloat*
Returns a string containing the extracted bits, represented as a binary sequence. The result is always padded to byte boundaries (multiples of 8 bits) String
bitTest(a, i)
staticmethod
bitTest(a, i)
a— Number to convert.(U)Int8/16/32/64orFloat*i— Position of the bit to return.(U)Int8/16/32/64orFloat*
Returns the value of the bit at position i in the binary representation of a UInt8
bitTestAll(a, index1, index2=None, indexN=None)
staticmethod
bitTestAll(a, index1[, index2, ... , indexN])
a— An integer value.(U)Int8/16/32/64index1, ...— One or multiple positions of bits.(U)Int8/16/32/64
Returns the result of the logical conjunction UInt8
bitTestAny(a, index1, index2=None, indexN=None)
staticmethod
bitTestAny(a, index1[, index2, ... , indexN])
a— An integer value.(U)Int8/16/32/64index1, ...— One or multiple positions of bits.(U)Int8/16/32/64
Returns the result of the logical disjunction UInt8
bitXor(a, b)
staticmethod
bitmapAnd(bitmap1, bitmap2)
staticmethod
bitmapAnd(bitmap1, bitmap2)
bitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T). Returns a bitmap containing bits present in both input bitmapsAggregateFunction(groupBitmap, T)
bitmapAndCardinality(bitmap1, bitmap2)
staticmethod
bitmapAndCardinality(bitmap1, bitmap2)
bitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T). Returns the number of set bits in the intersection of the two bitmapsUInt64
bitmapAndnot(bitmap1, bitmap2)
staticmethod
bitmapAndnot(bitmap1, bitmap2)
bitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T). Returns a bitmap containing set bits present in the first bitmap but not in the secondAggregateFunction(groupBitmap, T)
bitmapAndnotCardinality(bitmap1, bitmap2)
staticmethod
bitmapAndnotCardinality(bitmap1, bitmap2)
bitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T). Returns the number of set bits in the result ofbitmap1 AND-NOT bitmap2UInt64
bitmapBuild(array)
staticmethod
bitmapBuild(array)
array— Unsigned integer array.Array(UInt*)
Returns a bitmap from the provided array AggregateFunction(groupBitmap, T)
bitmapCardinality(bitmap)
staticmethod
bitmapCardinality(bitmap)
bitmap— Bitmap object.AggregateFunction(groupBitmap, T). Returns the number of bits set in the bitmapUInt64
bitmapContains(bitmap, value)
staticmethod
bitmapContains(bitmap, value)
bitmap— Bitmap object.AggregateFunction(groupBitmap, T). -value— Element to check for. (U)Int8/16/32/64 Returns1if the bitmap contains the specified value, otherwise0UInt8
bitmapHasAll(bitmap1, bitmap2)
staticmethod
bitmapHasAll(bitmap1, bitmap2)
bitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T). Returns1if all set bits of the second bitmap are present in the first bitmap, otherwise0UInt8
bitmapHasAny(bitmap1, bitmap2)
staticmethod
bitmapHasAny(bitmap1, bitmap2)
bitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T). Returns1if any bits of the second bitmap are present in the first bitmap, otherwise0UInt8
bitmapMax(bitmap)
staticmethod
bitmapMax(bitmap)
bitmap— Bitmap object.AggregateFunction(groupBitmap, T). Returns the position of the greatest bit set in the bitmap, otherwise0UInt64
bitmapMin(bitmap)
staticmethod
bitmapMin(bitmap)
bitmap— Bitmap object.AggregateFunction(groupBitmap, T). Returns the position of the smallest bit set in the bitmap, orUINT32_MAX/UINT64_MAXUInt64
bitmapOr(bitmap1, bitmap2)
staticmethod
bitmapOr(bitmap1, bitmap2)
bitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T). Returns a bitmap containing set bits present in either input bitmapAggregateFunction(groupBitmap, T)
bitmapOrCardinality(bitmap1, bitmap2)
staticmethod
bitmapOrCardinality(bitmap1, bitmap2)
bitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T). Returns the number of set bits in the union of the two bitmapsUInt64
bitmapSubsetInRange(bitmap, start, end)
staticmethod
bitmapSubsetInRange(bitmap, start, end)
bitmap— Bitmap to extract the subset from.AggregateFunction(groupBitmap, T). -start— Start of the range (inclusive).UInt*-end— End of the range (exclusive).UInt*Returns a bitmap containing only the set bits in the specified rangeAggregateFunction(groupBitmap, T)
bitmapSubsetLimit(bitmap, range_start, cardinality_limit)
staticmethod
bitmapSubsetLimit(bitmap, range_start, cardinality_limit)
bitmap— Bitmap object.AggregateFunction(groupBitmap, T). -range_start— Start of the range (inclusive).UInt32-cardinality_limit— Maximum cardinality of the subset.UInt32Returns a bitmap containing at mostcardinality_limitset bits, starting fromrange_startAggregateFunction(groupBitmap, T)
bitmapToArray(bitmap)
staticmethod
bitmapToArray(bitmap)
bitmap— Bitmap to convert.AggregateFunction(groupBitmap, T). Returns an array of unsigned integers contained in the bitmapArray(UInt*)
bitmapTransform(bitmap, from_array, to_array)
staticmethod
bitmapTransform(bitmap, from_array, to_array)
bitmap— Bitmap object.AggregateFunction(groupBitmap, T). -from_array— Array of original set bits to be replaced.Array(T). -to_array— Array of new set bits to replace with.Array(T). Returns a bitmap with elements transformed according to the given mappingAggregateFunction(groupBitmap, T)
bitmapXor(bitmap1, bitmap2)
staticmethod
bitmapXor(bitmap1, bitmap2)
bitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T). Returns a bitmap containing set bits present in either input bitmap, but not in bothAggregateFunction(groupBitmap, T)
bitmapXorCardinality(bitmap1, bitmap2)
staticmethod
bitmapXorCardinality(bitmap1, bitmap2)
bitmap1— First bitmap object.AggregateFunction(groupBitmap, T). -bitmap2— Second bitmap object.AggregateFunction(groupBitmap, T). Returns the number of set bits in the symmetric difference of the two bitmapsUInt64
bitmaskToArray(num)
staticmethod
bitmaskToArray(num)
num— An integer value.(U)Int*
Returns an array with the ascendingly ordered powers of two which sum up to the input number. Array(UInt64)
bitmaskToList(num)
staticmethod
blockNumber()
staticmethod
blockNumber()
Sequence number of the data block where the row is located. UInt64
blockSerializedSize(x1, x2=None)
staticmethod
blockSize()
staticmethod
blockSize()
Returns the number of rows in the current block. UInt64
boundingRatio(x, y)
staticmethod
buildId()
staticmethod
buildId()
Returns the build ID. String
byteHammingDistance(s1, s2)
staticmethod
byteSize(arg1, arg2=None)
staticmethod
byteSwap(x)
staticmethod
caseFoldUTF8(str)
staticmethod
caseWithExpression(*args)
staticmethod
catboostEvaluate(path_to_model, feature_1, feature_2=None, feature_n=None)
staticmethod
catboostEvaluate(path_to_model, feature_1[, feature_2, ..., feature_n])
path_to_model— Path to catboost model.const Stringfeature— One or more model features/arguments.Float*
Returns the model evaluation result. Float64
categoricalInformationValue(category1, category2=None, tag=None)
staticmethod
categoricalInformationValue(category1[, category2, ...,]tag)
category1, category2, ...— One or more categorical features to analyze. Each category should contain discrete values.UInt8tag— Binary target variable for prediction. Should contain values 0 and 1.UInt8
Returns an array of Float64 values representing the information value for each unique combination of categories. Each value indicates the predictive strength of that category combination for the target variable. Array(Float64)
cbrt(x)
staticmethod
ceil(x, N=None)
staticmethod
changeDay(date_or_datetime, value)
staticmethod
changeDay(date_or_datetime, value)
date_or_datetime— The value to change.DateorDate32orDateTimeorDateTime64value— The new value.(U)Int*
Returns a value of the same type as date_or_datetime with modified day component. Date or Date32 or DateTime or DateTime64
changeHour(date_or_datetime, value)
staticmethod
changeHour(date_or_datetime, value)
date_or_datetime— The value to change.DateorDate32orDateTimeorDateTime64value— The new value.(U)Int*
Returns a value of the same type as date_or_datetime with modified hour component. DateTime or DateTime64
changeMinute(date_or_datetime, value)
staticmethod
changeMinute(date_or_datetime, value)
date_or_datetime— The value to change.DateorDate32orDateTimeorDateTime64value— The new value.(U)Int*
Returns a value of the same type as date_or_datetime with modified minute component. DateTime or DateTime64
changeMonth(date_or_datetime, value)
staticmethod
changeMonth(date_or_datetime, value)
date_or_datetime— The value to change.DateorDate32orDateTimeorDateTime64value— The new value.(U)Int*
Returns a value of the same type as date_or_datetime with modified month component. Date or Date32 or DateTime or DateTime64
changeSecond(date_or_datetime, value)
staticmethod
changeSecond(date_or_datetime, value)
date_or_datetime— The value to change.DateorDate32orDateTimeorDateTime64value— The new value.(U)Int*
Returns a value of the same type as date_or_datetime with modified seconds component. DateTime or DateTime64
changeYear(date_or_datetime, value)
staticmethod
changeYear(date_or_datetime, value)
date_or_datetime— The value to change.DateorDate32orDateTimeorDateTime64value— The new value.(U)Int*
Returns a value of the same type as date_or_datetime with modified year component. Date or Date32 or DateTime or DateTime64
char(num1, num2=None)
staticmethod
char(num1[, num2[, ...]])
num1[, num2[, num3 ...]]— Numerical arguments interpreted as integers.(U)Int8/16/32/64orFloat*
Returns a string of the given bytes. String
cityHash64(arg1, arg2=None)
staticmethod
clamp(value, min, max)
staticmethod
clamp(value, min, max)
value— The value to clamp. -min— The minimum bound. -max— The maximum bound. Returns the value, restricted to the [min, max] range.
coalesce(x, y=None)
staticmethod
colorOKLABToSRGB(tuple, gamma=None)
staticmethod
colorOKLABToSRGB(tuple [, gamma])
tuple— A tuple of three numeric valuesL,a,b, whereLis in the range[0...1].Tuple(Float64, Float64, Float64)gamma— Optional. The exponent that is used to transform linear sRGB back to sRGB by applying(x ^ (1 / gamma)) * 255for each channelx. Defaults to2.2.Float64
Returns a tuple (R, G, B) representing sRGB color values. Tuple(Float64, Float64, Float64)
colorOKLCHToSRGB(tuple, gamma=None)
staticmethod
colorOKLCHToSRGB(tuple [, gamma])
tuple— A tuple of three numeric valuesL,C,H, whereLis in the range[0...1],C >= 0andHis in the range[0...360].Tuple(Float64, Float64, Float64)gamma— Optional. The exponent that is used to transform linear sRGB back to sRGB by applying(x ^ (1 / gamma)) * 255for each channelx. Defaults to2.2.Float64
Returns a tuple (R, G, B) representing sRGB color values. Tuple(Float64, Float64, Float64)
colorSRGBToOKLAB(tuple, gamma=None)
staticmethod
colorSRGBToOKLAB(tuple[, gamma])
tuple— Tuple of three values R, G, B in the range[0...255].Tuple(UInt8, UInt8, UInt8)gamma— Optional. Exponent that is used to linearize sRGB by applying(x / 255)^gammato each channelx. Defaults to2.2.Float64
Returns a tuple (L, a, b) representing the OKLAB color space values. Tuple(Float64, Float64, Float64)
colorSRGBToOKLCH(tuple, gamma=None)
staticmethod
colorSRGBToOKLCH(tuple[, gamma])
tuple— Tuple of three values R, G, B in the range[0...255].Tuple(UInt8, UInt8, UInt8)gamma— Optional. Exponent that is used to linearize sRGB by applying(x / 255)^gammato each channelx. Defaults to2.2.Float64
Returns a tuple (L, C, H) representing the OKLCH color space values. Tuple(Float64, Float64, Float64)
compareSubstrings(s1, s2, s1_offset, s2_offset, num_bytes)
staticmethod
compareSubstrings(s1, s2, s1_offset, s2_offset, num_bytes)
s1— The first string to compare.Strings2— The second string to compare.Strings1_offset— The position (zero-based) ins1from which the comparison starts.UInt*s2_offset— The position (zero-based index) ins2from which the comparison starts.UInt*num_bytes— The maximum number of bytes to compare in both strings. Ifs1_offset(ors2_offset) +num_bytesexceeds the end of an input string,num_byteswill be reduced accordingly.UInt*
Returns:
- -1 if s1[s1_offset : s1_offset + num_bytes] < s2[s2_offset : s2_offset + num_bytes].
- 0 if s1[s1_offset : s1_offset + num_bytes] = s2[s2_offset : s2_offset + num_bytes].
- 1 if s1[s1_offset : s1_offset + num_bytes] > s2[s2_offset : s2_offset + num_bytes].
Int8
concat(s1=None, s2=None)
staticmethod
concat([s1, s2, ...])
s1, s2, ...— Any number of values of arbitrary type.Any
Returns the String created by concatenating the arguments. If any of arguments is NULL, the function returns NULL. If there are no arguments, it returns an empty string. Nullable(String)
concatAssumeInjective(s1=None, s2=None)
staticmethod
concatAssumeInjective([s1, s2, ...])
s1, s2, ...— Any number of values of arbitrary type.StringorFixedString
Returns the string created by concatenating the arguments. If any of argument values is NULL, the function returns NULL. If no arguments are passed, it returns an empty string. String
concatWithSeparator(sep, exp1=None, exp2=None)
staticmethod
concatWithSeparator(sep[, exp1, exp2, ...])
sep— The separator to use.const Stringorconst FixedStringexp1, exp2, ...— Expression to be concatenated. Arguments which are not of typeStringorFixedStringare converted to strings using their default serialization. As this decreases performance, it is not recommended to use non-String/FixedString arguments.Any
Returns the String created by concatenating the arguments. If any of the argument values is NULL, the function returns NULL. String
concatWithSeparatorAssumeInjective(sep, exp1=None, exp2=None)
staticmethod
concatWithSeparatorAssumeInjective(sep[, exp1, exp2, ... ])
sep— The separator to use.const Stringorconst FixedStringexp1, exp2, ...— Expression to be concatenated. Arguments which are not of typeStringorFixedStringare converted to strings using their default serialization. As this decreases performance, it is not recommended to use non-String/FixedString arguments.StringorFixedString
Returns the String created by concatenating the arguments. If any of the argument values is NULL, the function returns NULL. String
connectionId()
staticmethod
connectionId()
Returns the connection ID of the current client. UInt64
contingency(column1, column2)
staticmethod
conv(number, from_base, to_base)
staticmethod
conv(number, from_base, to_base)
number— The number to convert. Can be a string or numeric type. -from_base— The source base (2-36). Must be an integer. -to_base— The target base (2-36). Must be an integer. String representation of the number in the target base.
convertCharset(s, from_, to)
staticmethod
corr(x, y)
staticmethod
corrMatrix(x1, x2=None)
staticmethod
corrMatrix(x1[, x2, ...])
x1[, x2, ...]— One or more parameters for which to compute the correlation matrix over.(U)Int8/16/32/64orFloat*
Returns the correlation matrix. Array(Array(Float64))
corrStable(x, y)
staticmethod
cos(x)
staticmethod
cosh(x)
staticmethod
cosineDistance(vector1, vector2)
staticmethod
cosineDistanceTransposed(vector1, vector2, p)
staticmethod
cosineDistanceTransposed(vector1, vector2, p)
vectors— Vectors.QBit(T, UInt64)reference— Reference vector.Array(T)p— Number of bits from each vector element to use in the distance calculation (1 to element bit-width). The quantization level controls the precision-speed trade-off. Using fewer bits results in faster I/O and calculations with reduced accuracy, while using more bits increases accuracy at the cost of performance.UInt
Returns the approximate cosine of the angle between two vectors subtracted from one. Float64
count(expr=None)
staticmethod
count([expr])
expr— Optional. An expression. The function counts how many times this expression returned not null.Expression
Returns the a row count if the function is called without parameters, otherwise returns a count of how many times the passed expression returned not null. UInt64
countDigits(x)
staticmethod
countEqual(arr, x)
staticmethod
countMatches(haystack, pattern)
staticmethod
countMatchesCaseInsensitive(haystack, pattern)
staticmethod
countMatchesCaseInsensitive(haystack, pattern)
haystack— The string to search in.Stringpattern— Regular expression pattern.const String
Returns the number of matches found. UInt64
countSubstrings(haystack, needle, start_pos=None)
staticmethod
countSubstringsCaseInsensitive(haystack, needle, start_pos=None)
staticmethod
countSubstringsCaseInsensitive(haystack, needle[, start_pos])
haystack— String in which the search is performed.StringorEnumneedle— Substring to be searched.Stringstart_pos— Optional. Position (1-based) inhaystackat which the search starts.UInt*
Returns the number of occurrences of the neddle in the haystack. UInt64
countSubstringsCaseInsensitiveUTF8(haystack, needle, start_pos=None)
staticmethod
countSubstringsCaseInsensitiveUTF8(haystack, needle[, start_pos])
haystack— UTF-8 string in which the search is performed.StringorEnumneedle— Substring to be searched.Stringstart_pos— Optional. Position (1-based) inhaystackat which the search starts.UInt*
Returns the number of occurrences of the needle in the haystack. UInt64
covarPop(x, y)
staticmethod
covarPopMatrix(x1, x2=None)
staticmethod
covarPopMatrix(x1[, x2, ...])
Returns the population covariance matrix. Array(Array(Float64))
covarPopStable(x, y)
staticmethod
covarSamp(x, y)
staticmethod
covarSampMatrix(x1, x2=None)
staticmethod
covarSampMatrix(x1[, x2, ...])
x1[, x2, ...]— One or more parameters over which to compute the sample covariance matrix.(U)Int*orFloat*orDecimal
Returns the sample covariance matrix. Array(Array(Float64))
covarSampStable(x, y)
staticmethod
cramersV(column1, column2)
staticmethod
cramersVBiasCorrected(column1, column2)
staticmethod
cume_dist(*args)
staticmethod
currentDatabase()
staticmethod
currentDatabase()
Returns the current database name. String
currentProfiles()
staticmethod
currentProfiles()
Returns an array of setting profiles for the current user. Array(String)
currentQueryID()
staticmethod
currentQueryID()
currentRoles()
staticmethod
currentRoles()
Returns an array of the roles which are assigned to the current user. Array(String)
currentSchemas(bool)
staticmethod
currentSchemas(bool)
bool— A boolean value, which is ignored.Bool
Returns a single-element array with the name of the current database. Array(String)
currentUser()
staticmethod
currentUser()
Returns the name of the current user, otherwise the login of the user who initiated the query. String
cutFragment(url)
staticmethod
cutIPv6(x, bytesToCutForIPv6, bytesToCutForIPv4)
staticmethod
cutIPv6(x, bytesToCutForIPv6, bytesToCutForIPv4)
x— IPv6 address in binary format.FixedString(16)orIPv6bytesToCutForIPv6— Number of bytes to cut for IPv6.UInt8bytesToCutForIPv4— Number of bytes to cut for IPv4.UInt8
Returns a string containing the IPv6 address in text format with specified bytes removed. String
cutQueryString(url)
staticmethod
cutQueryStringAndFragment(url)
staticmethod
cutToFirstSignificantSubdomain(url)
staticmethod
cutToFirstSignificantSubdomainCustom(url, tld_list_name)
staticmethod
cutToFirstSignificantSubdomainCustom(url, tld_list_name)
url— URL or domain string to process.Stringtld_list_name— Name of the custom TLD list configured in ClickHouse.const String
Returns the part of the domain that includes top-level subdomains up to the first significant subdomain. String
cutToFirstSignificantSubdomainCustomRFC(url, tld_list_name)
staticmethod
cutToFirstSignificantSubdomainCustomRFC(url, tld_list_name)
url— URL or domain string to process according to RFC 3986. -tld_list_name— Name of the custom TLD list configured in ClickHouse. Returns the part of the domain that includes top-level subdomains up to the first significant subdomain.String
cutToFirstSignificantSubdomainCustomWithWWW(url, tld_list_name)
staticmethod
cutToFirstSignificantSubdomainCustomWithWWW(url, tld_list_name)
url— URL or domain string to process. -tld_list_name— Name of the custom TLD list configured in ClickHouse. Part of the domain that includes top-level subdomains up to the first significant subdomain without stripping 'www'.String
cutToFirstSignificantSubdomainCustomWithWWWRFC(url, tld_list_name)
staticmethod
cutToFirstSignificantSubdomainCustomWithWWWRFC(url, tld_list_name)
url— URL or domain string to process according to RFC 3986. -tld_list_name— Name of the custom TLD list configured in ClickHouse. Returns the part of the domain that includes top-level subdomains up to the first significant subdomain without strippingwww.String
cutToFirstSignificantSubdomainRFC(url)
staticmethod
cutToFirstSignificantSubdomainWithWWW(url)
staticmethod
cutToFirstSignificantSubdomainWithWWWRFC(url)
staticmethod
cutToFirstSignificantSubdomainWithWWWRFC(url)
url— URL or domain string to process according to RFC 3986. Returns the part of the domain that includes top-level subdomains up to the first significant subdomain (with 'www') if possible, otherwise returns an empty stringString
cutURLParameter(url, name)
staticmethod
cutURLParameter(url, name)
url— URL.Stringname— Name of URL parameter.StringorArray(String)
URL with name URL parameter removed. String
cutWWW(url)
staticmethod
damerauLevenshteinDistance(s1, s2)
staticmethod
dateDiff(unit, startdate, enddate, timezone=None)
staticmethod
dateDiff(unit, startdate, enddate[, timezone])
unit— The type of interval for result.
| Unit | Possible values |
|---|---|
| nanosecond | nanosecond, nanoseconds, ns |
| microsecond | microsecond, microseconds, us, u |
| millisecond | millisecond, milliseconds, ms |
| second | second, seconds, ss, s |
| minute | minute, minutes, mi, n |
| hour | hour, hours, hh, h |
| day | day, days, dd, d |
| week | week, weeks, wk, ww |
| month | month, months, mm, m |
| quarter | quarter, quarters, qq, q |
| year | year, years, yyyy, yy |
- startdate — The first time value to subtract (the subtrahend). Date or Date32 or DateTime or DateTime64 |
|
- enddate — The second time value to subtract from (the minuend). Date or Date32 or DateTime or DateTime64 |
|
- timezone — Optional. Timezone name. If specified, it is applied to both startdate and enddate. If not specified, timezones of startdate and enddate are used. If they are not the same, the result is unspecified. String |
Returns the difference between enddate and startdate expressed in unit. Int64
dateName(date_part, date, timezone=None)
staticmethod
dateTime64ToSnowflake(value)
staticmethod
dateTime64ToSnowflake(value)
value— Date with time.DateTime64
Returns the input value converted as the first Snowflake ID at that time. Int64
dateTime64ToSnowflakeID(value, epoch=None)
staticmethod
dateTime64ToSnowflakeID(value[, epoch])
value— Date with time.DateTime64epoch— Epoch of the Snowflake ID in milliseconds since 1970-01-01. Defaults to 0 (1970-01-01). For the Twitter/X epoch (2015-01-01), provide 1288834974657.UInt*
Input value converted to UInt64
dateTimeToSnowflake(value)
staticmethod
dateTimeToSnowflakeID(value, epoch=None)
staticmethod
dateTimeToUUIDv7(value)
staticmethod
dateTrunc(unit, datetime, timezone=None)
staticmethod
dateTrunc(unit, datetime[, timezone])
unit— The type of interval to truncate the result. Possible values:nanosecond(only DateTime64),microsecond(only DateTime64),millisecond(only DateTime64),second,minute,hour,day,week,month,quarter,year.Stringdatetime— Date and time.DateorDate32orDateTimeorDateTime64timezone— Optional. Timezone name for the returned datetime. If not specified, the function uses the timezone of thedatetimeparameter.String
Returns the truncated date and time value.
| Unit Argument | datetime Argument |
Return Type |
|---|---|---|
| Year, Quarter, Month, Week | Date32 or DateTime64 or Date or DateTime |
Date32 or Date |
| Day, Hour, Minute, Second | Date32, DateTime64, Date, or DateTime |
DateTime64 or DateTime |
| Millisecond, Microsecond, | Any | DateTime64 |
| Nanosecond | with scale 3, 6, or 9 |
decodeHTMLComponent(s)
staticmethod
decodeURLComponent(url)
staticmethod
decodeURLFormComponent(url)
staticmethod
decodeXMLComponent(s)
staticmethod
decrypt(mode, ciphertext, key, iv=None, aad=None)
staticmethod
decrypt(mode, ciphertext, key[, iv, aad])
mode— Decryption mode.Stringciphertext— Encrypted text that should be decrypted.Stringkey— Decryption key.Stringiv— Initialization vector. Required for-gcmmodes, optional for others.Stringaad— Additional authenticated data. Won't decrypt if this value is incorrect. Works only in-gcmmodes, for others throws an exception.String
Returns decrypted plaintext. String
defaultProfiles()
staticmethod
defaultProfiles()
Returns an array of default setting profile names for the current user. Array(String)
defaultRoles()
staticmethod
defaultRoles()
Returns an array of default roles for the current user. Array(String)
defaultValueOfArgumentType(expression)
staticmethod
defaultValueOfTypeName(type)
staticmethod
degrees(x)
staticmethod
deltaSum(x1, x2=None)
staticmethod
deltaSumTimestamp(value, timestamp)
staticmethod
deltaSumTimestamp(value, timestamp)
value— Input values.(U)Int*orFloat*orDateorDateTimetimestamp— The parameter for order values.(U)Int*orFloat*orDateorDateTime
Returns accumulated differences between consecutive values, ordered by the timestamp parameter. (U)Int* or Float* or Date or DateTime
demangle(symbol)
staticmethod
denseRank(*args)
staticmethod
detectCharset(s)
staticmethod
detectLanguage(s)
staticmethod
detectLanguageMixed(s)
staticmethod
detectLanguageMixed(s)
s— The text to analyzeString
Returns a map with keys which are 2-letter ISO codes and corresponding values which are a percentage of the text found for that language Map(String, Float32)
detectLanguageUnknown(s)
staticmethod
detectTonality(s)
staticmethod
dictGet(dict_name, attr_names, id_expr)
staticmethod
dictGet('dict_name', attr_names, id_expr)
dict_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)
Returns the value of the dictionary attribute that corresponds to id_expr if the key is found.
If the key is not found, returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
dictGetAll(dict_name, attr_name, id_expr)
staticmethod
dictGetAll(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetChildren(dict_name, key)
staticmethod
dictGetChildren(dict_name, key)
dict_name— Name of the dictionary.Stringkey— Key to be checked.const String
Returns the first-level descendants for the key. Array(UInt64)
dictGetDate(dict_name, attr_name, id_expr)
staticmethod
dictGetDate(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetDateOrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetDateOrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetDateTime(dict_name, attr_name, id_expr)
staticmethod
dictGetDateTime(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetDateTimeOrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetDateTimeOrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetDescendants(dict_name, key, level)
staticmethod
dictGetDescendants(dict_name, key, level)
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
Returns the descendants for the key. Array(UInt64)
dictGetFloat32(dict_name, attr_name, id_expr)
staticmethod
dictGetFloat32(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetFloat32OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetFloat32OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetFloat64(dict_name, attr_name, id_expr)
staticmethod
dictGetFloat64(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetFloat64OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetFloat64OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetHierarchy(dict_name, key)
staticmethod
dictGetHierarchy(dict_name, key)
dict_name— Name of the dictionary.Stringkey— Key value.const String
Returns parents for the key. Array(UInt64)
dictGetIPv4(dict_name, attr_name, id_expr)
staticmethod
dictGetIPv4(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetIPv4OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetIPv4OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetIPv6(dict_name, attr_name, id_expr)
staticmethod
dictGetIPv6(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetIPv6OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetIPv6OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetInt16(dict_name, attr_name, id_expr)
staticmethod
dictGetInt16(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetInt16OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetInt16OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetInt32(dict_name, attr_name, id_expr)
staticmethod
dictGetInt32(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetInt32OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetInt32OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetInt64(dict_name, attr_name, id_expr)
staticmethod
dictGetInt64(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetInt64OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetInt64OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetInt8(dict_name, attr_name, id_expr)
staticmethod
dictGetInt8(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetInt8OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetInt8OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetKeys(dict_name, attr_name, value_expr)
staticmethod
dictGetKeys('dict_name', 'attr_name', value_expr)
dict_name— Name of the dictionary.Stringattr_name— Attribute to match.Stringvalue_expr— Value to match against the attribute.Expression
For single key dictionaries: an array of keys whose attribute equals 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.
dictGetOrDefault(dict_name, attr_names, id_expr, default_value)
staticmethod
dictGetOrDefault('dict_name', attr_names, id_expr, default_value)
dict_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. Returns the value of the dictionary attribute that corresponds toid_exprif the key is found. If the key is not found, returns thedefault_valueprovided.
dictGetOrNull(dict_name, attr_name, id_expr)
staticmethod
dictGetOrNull('dict_name', 'attr_name', id_expr)
dict_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. Returns the value of the dictionary attribute that corresponds toid_exprif the key is found. If the key is not found, returnsNULL.
dictGetString(dict_name, attr_name, id_expr)
staticmethod
dictGetString(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetStringOrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetStringOrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetUInt16(dict_name, attr_name, id_expr)
staticmethod
dictGetUInt16(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetUInt16OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetUInt16OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetUInt32(dict_name, attr_name, id_expr)
staticmethod
dictGetUInt32(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetUInt32OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetUInt32OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetUInt64(dict_name, attr_name, id_expr)
staticmethod
dictGetUInt64(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetUInt64OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetUInt64OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetUInt8(dict_name, attr_name, id_expr)
staticmethod
dictGetUInt8(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetUInt8OrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetUInt8OrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetUUID(dict_name, attr_name, id_expr)
staticmethod
dictGetUUID(dict_name, attr_name, id_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the content of the <null_value> element specified for the attribute in the dictionary configuration.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictGetUUIDOrDefault(dict_name, attr_name, id_expr, default_value_expr)
staticmethod
dictGetUUIDOrDefault(dict_name, attr_name, id_expr, default_value_expr)
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)
Returns the value of the dictionary attribute that corresponds to id_expr,
otherwise returns the value passed as the default_value_expr parameter.
note ClickHouse throws an exception if it cannot parse the value of the attribute or the value does not match the attribute data type.
dictHas(dict_name, id_expr)
staticmethod
dictHas('dict_name', id_expr)
dict_name— Name of the dictionary.Stringid_expr— Key valueconst String
Returns 1 if the key exists, otherwise 0. UInt8
dictIsIn(dict_name, child_id_expr, ancestor_id_expr)
staticmethod
dictIsIn(dict_name, child_id_expr, ancestor_id_expr)
dict_name— Name of the dictionary.Stringchild_id_expr— Key to be checked.Stringancestor_id_expr— Alleged ancestor of thechild_id_exprkey.const String
Returns 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
displayName()
staticmethod
displayName()
Returns the value of display_name from config or server FQDN if not set. String
distinctDynamicTypes(dynamic)
staticmethod
distinctDynamicTypes(dynamic)
dynamic— Dynamic column.Dynamic
Returns the sorted list of data type names. Array(String)
distinctJSONPaths(json)
staticmethod
distinctJSONPathsAndTypes(json)
staticmethod
distinctJSONPathsAndTypes(json)
json— JSON column.JSON
Returns the sorted map of paths and types. Map(String, Array(String))
divide(x, y)
staticmethod
divide(x, y)
x— Dividend -y— Divisor The quotient of x and y
divideDecimal(x, y, result_scale=None)
staticmethod
divideDecimal(x, y[, result_scale])
x— First value: Decimal. -y— Second value: Decimal. -result_scale— Scale of result. Type Int/UInt. The result of division with given scale.Decimal256
divideOrNull(x, y)
staticmethod
divideOrNull(x, y)
x— Dividend -y— Divisor The quotient of x and y, or NULL.
domain(url)
staticmethod
domainRFC(url)
staticmethod
domainWithoutWWW(url)
staticmethod
domainWithoutWWWRFC(url)
staticmethod
dotProduct(vector1, vector2)
staticmethod
dumpColumnStructure(x)
staticmethod
dynamicElement(dynamic, type_name)
staticmethod
dynamicElement(dynamic, type_name)
dynamicType(dynamic)
staticmethod
e()
staticmethod
e()
Returns Euler's constant Float64
editDistance(s1, s2)
staticmethod
editDistanceUTF8(s1, s2)
staticmethod
empty(arr)
staticmethod
emptyArrayDate()
staticmethod
emptyArrayDate()
An empty Date array. Array(T)
emptyArrayDateTime()
staticmethod
emptyArrayDateTime()
An empty DateTime array. Array(T)
emptyArrayFloat32()
staticmethod
emptyArrayFloat32()
An empty Float32 array. Array(T)
emptyArrayFloat64()
staticmethod
emptyArrayFloat64()
An empty Float64 array. Array(T)
emptyArrayInt16()
staticmethod
emptyArrayInt16()
An empty Int16 array. Array(T)
emptyArrayInt32()
staticmethod
emptyArrayInt32()
An empty Int32 array. Array(T)
emptyArrayInt64()
staticmethod
emptyArrayInt64()
An empty Int64 array. Array(T)
emptyArrayInt8()
staticmethod
emptyArrayInt8()
An empty Int8 array. Array(T)
emptyArrayString()
staticmethod
emptyArrayString()
An empty String array. Array(T)
emptyArrayToSingle(arr)
staticmethod
emptyArrayUInt16()
staticmethod
emptyArrayUInt16()
An empty UInt16 array. Array(T)
emptyArrayUInt32()
staticmethod
emptyArrayUInt32()
An empty UInt32 array. Array(T)
emptyArrayUInt64()
staticmethod
emptyArrayUInt64()
An empty UInt64 array. Array(T)
emptyArrayUInt8()
staticmethod
emptyArrayUInt8()
An empty UInt8 array. Array(T)
enabledProfiles()
staticmethod
enabledProfiles()
Returns an array of setting profile names which are enabled for the current user. Array(String)
enabledRoles()
staticmethod
enabledRoles()
Returns an array of role names which are enabled for the current user. Array(String)
encodeURLComponent(url)
staticmethod
encodeURLFormComponent(url)
staticmethod
encodeXMLComponent(s)
staticmethod
encrypt(mode, plaintext, key, iv=None, aad=None)
staticmethod
encrypt(mode, plaintext, key[, iv, aad])
mode— Encryption mode.Stringplaintext— Text that should be encrypted.Stringkey— Encryption key.Stringiv— Initialization vector. Required for-gcmmodes, optional for others.Stringaad— Additional authenticated data. It isn't encrypted, but it affects decryption. Works only in-gcmmodes, for others it throws an exception.String
Returns binary string ciphertext. String
endsWith(s, suffix)
staticmethod
endsWithCaseInsensitive(s, suffix)
staticmethod
endsWithCaseInsensitiveUTF8(s, suffix)
staticmethod
endsWithUTF8(s, suffix)
staticmethod
entropy(val)
staticmethod
equals(a, b)
staticmethod
erf(x)
staticmethod
erfc(x)
staticmethod
errorCodeToName(error_code)
staticmethod
estimateCompressionRatio(codec=None, block_size_bytes=None)
staticmethod
evalMLMethod(model, x1, x2=None)
staticmethod
evalMLMethod(model, x1[, x2, ...])
model— The trained machine learning model.AggregateFunctionStatex1, x2, ...— Feature values for prediction.Float*or(U)Int*
Returns the predicted value based on the trained model. Float64
exponentialMovingAverage(x)
staticmethod
exponentialMovingAverage(x)(value, timeunit)
value— Value.(U)Int*orFloat*orDecimaltimeunit— Timeunit. Timeunit is not timestamp (seconds), it's an index of the time interval. Can be calculated usingintDiv.(U)Int*orFloat*orDecimal
Returns an exponentially smoothed moving average of the values for the past x time at the latest point of time. Float64
exponentialTimeDecayedAvg(x)
staticmethod
exponentialTimeDecayedCount(x)
staticmethod
exponentialTimeDecayedMax(x)
staticmethod
exponentialTimeDecayedSum(x)
staticmethod
extract(haystack, pattern)
staticmethod
extract(haystack, pattern)
haystack— String from which to extract.Stringpattern— Regular expression, typically containing a capturing group.const String
Returns extracted fragment as a string. String
extractAll(haystack, pattern)
staticmethod
extractAll(haystack, pattern)
haystack— String from which to extract fragments.Stringpattern— Regular expression, optionally containing capturing groups.const String
Returns array of extracted fragments. Array(String)
extractAllGroupsHorizontal(s, regexp)
staticmethod
extractAllGroupsHorizontal(s, regexp)
s— Input string to extract from.StringorFixedStringregexp— Regular expression to match by.const Stringorconst FixedString
Returns an array of arrays, where each inner array contains all captures from one capturing group across all matches. The first inner array contains all captures from group 1, the second from group 2, etc. If no matches are found, returns an empty array. Array(Array(String))
extractAllGroupsVertical(s, regexp)
staticmethod
extractAllGroupsVertical(s, regexp)
s— Input string to extract from.StringorFixedStringregexp— Regular expression to match by.const Stringorconst FixedString
Returns an array of arrays, where each inner array contains the captured groups from one match. Each match produces an array with elements corresponding to the capturing groups in the regular expression (group 1, group 2, etc.). If no matches are found, returns an empty array. Array(Array(String))
extractGroups(s, regexp)
staticmethod
extractGroups(s, regexp)
s— Input string to extract from.StringorFixedStringregexp— Regular expression. Constant.const Stringorconst FixedString
If the function finds at least one matching group, it returns Array(Array(String)) column, clustered by group_id (1 to N, where N is number of capturing groups in regexp). If there is no matching group, it returns an empty array. Array(Array(String))
extractKeyValuePairs(input)
staticmethod
extractKeyValuePairs(input)
extractKeyValuePairsWithEscaping(input)
staticmethod
extractKeyValuePairsWithEscaping(input)
extractTextFromHTML(html)
staticmethod
extractURLParameter(url, name)
staticmethod
extractURLParameterNames(url)
staticmethod
extractURLParameterNames(url)
url— URL.String
Returns an array of name strings corresponding to the names of URL parameters. Array(String)
extractURLParameters(url)
staticmethod
extractURLParameters(url)
url— URL.String
Returns an array of name=value strings corresponding to the URL parameters. Array(String)
factorial(n)
staticmethod
factorial(n)
n— Integer value for which to calculate the factorial. Maximum value is 20.(U)Int8/16/32/64
Returns the factorial of the input as UInt64. Returns 1 for input 0 or any negative value. UInt64
farmFingerprint64(arg1, arg2=None)
staticmethod
farmHash64(arg1, arg2=None)
staticmethod
file(path, default=None)
staticmethod
file(path[, default])
path— The path of the file relative to theuser_files_path. Supports wildcards*,**,?,{abc,def}and{N..M}whereN,Mare numbers and'abc', 'def'are strings.Stringdefault— The value returned if the file does not exist or cannot be accessed.StringorNULL
Returns the file content as a string. String
filesystemAvailable(disk_name=None)
staticmethod
filesystemAvailable([disk_name])
disk_name— Optional. The disk name to find the amount of free space for. If omitted, uses the default disk.StringorFixedString
Returns the amount of remaining space available in bytes. UInt64
filesystemCapacity(disk_name=None)
staticmethod
filesystemCapacity([disk_name])
disk_name— Optional. The disk name to get the capacity for. If omitted, uses the default disk.StringorFixedString
Returns the capacity of the filesystem in bytes. UInt64
filesystemUnreserved(disk_name=None)
staticmethod
filesystemUnreserved([disk_name])
disk_name— Optional. The disk name for which to find the total amount of free space. If omitted, uses the default disk.StringorFixedString
Returns the amount of free space in bytes. UInt64
finalizeAggregation(state)
staticmethod
finalizeAggregation(state)
state— State of aggregation.AggregateFunction
Returns the finalized result of aggregation. Any
financialInternalRateOfReturn(cashflows, guess=None)
staticmethod
financialInternalRateOfReturn(cashflows[, guess])
cashflows— Array of cash flows. Each value represents a payment (negative value) or income (positive value).Array(Int8/16/32/64)orArray(Float*)[, guess]— Optional initial guess (constant value) for the internal rate of return (default 0.1).Float*
Returns the internal rate of return or NaN if the calculation cannot converge, input array is empty or has only one element, all cash flows are zero, or other calculation errors occur. Float64
financialInternalRateOfReturnExtended(cashflow, date, guess=None, daycount=None)
staticmethod
financialInternalRateOfReturnExtended(cashflow, date [, guess, daycount])
cashflow— An array of cash flows corresponding to the dates in second param.Array(Int8/16/32/64)orArray(Float*)date— A sorted array of unique dates corresponding to the cash flows.Array(Date)orArray(Date32)[, guess]— Optional. Initial guess (constant value) for the XIRR calculation.Float*[, daycount]— Optional day count convention (default 'ACT_365F'). Supported values:- 'ACT_365F' - Actual/365 Fixed: Uses actual number of days between dates divided by 365
- 'ACT_365_25' - Actual/365.25: Uses actual number of days between dates divided by 365.25
String
Returns the XIRR value. If the calculation cannot be performed, it returns NaN. Float64
financialNetPresentValue(rate, cashflows, start_from_zero=None)
staticmethod
financialNetPresentValue(rate, cashflows[, start_from_zero])
rate— The discount rate to apply.Float*cashflows— Array of cash flows. Each value represents a payment (negative value) or income (positive value).Array(Int8/16/32/64)orArray(Float*)[, start_from_zero]— Optional boolean parameter indicating whether to start the NPV calculation from period0(true) or period1(false, Excel-compatible). Default: true.Bool
Returns the net present value as a Float64 value. Float64
financialNetPresentValueExtended(rate, cashflows, dates, daycount=None)
staticmethod
financialNetPresentValueExtended(rate, cashflows, dates[, daycount])
rate— The discount rate to apply.Float*cashflows— Array of cash flows. Each value represents a payment (negative value) or income (positive value). Must contain at least one positive and one negative value.Array(Int8/16/32/64)orArray(Float*)dates— Array of dates corresponding to each cash flow. Must have the same size as cashflows array.Array(Date)orArray(Date32)[, daycount]— Optional day count convention. Supported values:'ACT_365F'(default) — Actual/365 Fixed,'ACT_365_25'— Actual/365.25.String
Returns the net present value as a Float64 value. Float64
firstLine(s)
staticmethod
firstNonDefault(arg1, arg2=None)
staticmethod
firstNonDefault(arg1[, arg2[ ...]])
arg1— The first argument to check -arg2— The second argument to check -...— Additional arguments to check Result type is the supertype of all arguments
firstSignificantSubdomain(url)
staticmethod
firstSignificantSubdomain(url)
firstSignificantSubdomainCustom(url, tld_list_name)
staticmethod
firstSignificantSubdomainCustomRFC(url, tld_list_name)
staticmethod
firstSignificantSubdomainRFC(url)
staticmethod
firstSignificantSubdomainRFC(url)
flameGraph(traces, size=None, ptr=None)
staticmethod
flameGraph(traces[, size[, ptr]])
traces— A stacktrace.Array(UInt64)size— Optional. An allocation size for memory profiling (default 1).UInt64ptr— Optional. An allocation address (default 0).UInt64
Returns an array of strings for use with flamegraph.pl utility. Array(String)
flattenTuple(input)
staticmethod
flattenTuple(input)
input— Named and nested tuple to flatten.Tuple(n1 T1[, n2 T2, ... ])
Returns an output tuple whose elements are paths from the original input. Tuple(T)
flipCoordinates(geometry)
staticmethod
flipCoordinates(geometry)
geometry— The geometry to transform. Supported types: Point (Tuple(Float64, Float64)), Ring (Array(Point)), Polygon (Array(Ring)), MultiPolygon (Array(Polygon)), LineString (Array(Point)), MultiLineString (Array(LineString)), or Geometry (a variant containing any of these types). The geometry with flipped coordinates. The return type matches the input type.PointorRingorPolygonorMultiPolygonorLineStringorMultiLineStringorGeometry
floor(x, N=None)
staticmethod
format(pattern, s0, s1=None)
staticmethod
formatDateTime(datetime, format, timezone=None)
staticmethod
formatDateTime(datetime, format[, timezone])
datetime— A date or date time to format.DateorDate32orDateTimeorDateTime64format— Format string with replacement fields.Stringtimezone— Optional. Timezone name for the formatted time.String
Returns time and date values according to the determined format. String
formatDateTimeInJodaSyntax(datetime, format, timezone=None)
staticmethod
formatDateTimeInJodaSyntax(datetime, format[, timezone])
datetime— A date or date time to format.DateTimeorDateorDate32orDateTime64format— Format string with Joda-style replacement fields.Stringtimezone— Optional. Timezone name for the formatted time.String
Returns time and date values according to the determined format. String
formatQuery(query)
staticmethod
formatQueryOrNull(query)
staticmethod
formatQuerySingleLine(query)
staticmethod
formatQuerySingleLineOrNull(query)
staticmethod
formatReadableDecimalSize(x)
staticmethod
formatReadableQuantity(x)
staticmethod
formatReadableSize(x)
staticmethod
formatReadableTimeDelta(column, maximum_unit=None, minimum_unit=None)
staticmethod
formatReadableTimeDelta(column[, maximum_unit, minimum_unit])
column— A column with a numeric time delta.Float64maximum_unit— Optional. Maximum unit to show. Acceptable values:nanoseconds,microseconds,milliseconds,seconds,minutes,hours,days,months,years. Default value:years.const Stringminimum_unit— Optional. Minimum unit to show. All smaller units are truncated. Acceptable values:nanoseconds,microseconds,milliseconds,seconds,minutes,hours,days,months,years. If explicitly specified value is bigger thanmaximum_unit, an exception will be thrown. Default value:secondsifmaximum_unitissecondsor bigger,nanosecondsotherwise.const String
Returns a time delta as a string. String
formatRow(format, x, y)
staticmethod
formatRowNoNewline(format, x, y)
staticmethod
fragment(url)
staticmethod
fromDaysSinceYearZero(days)
staticmethod
fromDaysSinceYearZero32(days)
staticmethod
fromModifiedJulianDay(day)
staticmethod
fromModifiedJulianDayOrNull(day)
staticmethod
fromModifiedJulianDayOrNull(day)
day— Modified Julian Day number.(U)Int*
Returns date in text form for valid day argument, otherwise null. Nullable(String)
fromUTCTimestamp(datetime, time_zone)
staticmethod
fromUTCTimestamp(datetime, time_zone)
datetime— A date or date with time const value or an expression.DateTimeorDateTime64time_zone— A String type const value or an expression representing the time zone.String
Returns DateTime/DateTime64 in the specified timezone. DateTime or DateTime64
fromUnixTimestamp(timestamp)
staticmethod
fromUnixTimestamp(timestamp) fromUnixTimestamp(timestamp[, format[, timezone]])
timestamp— Unix timestamp or date/date with time value.(U)Int*orDateorDate32orDateTimeorDateTime64format— Optional. Constant format string for output formatting.Stringtimezone— Optional. Constant time zone string.String
Returns DateTime of the timestamp when called with one argument, or a String when called with two or three arguments. DateTime or String
fromUnixTimestamp64Micro(value, timezone=None)
staticmethod
fromUnixTimestamp64Micro(value[, timezone])
value— Unix timestamp in microseconds.Int64timezone— Optional. Timezone for the returned value.String
Returns a DateTime64 value with microsecond precision. DateTime64(6)
fromUnixTimestamp64Milli(value, timezone=None)
staticmethod
fromUnixTimestamp64Milli(value[, timezone])
value— Unix timestamp in milliseconds.Int64timezone— Optional. Timezone for the returned value.String
A DateTime64 value with millisecond precision. DateTime64(3)
fromUnixTimestamp64Nano(value, timezone=None)
staticmethod
fromUnixTimestamp64Nano(value[, timezone])
value— Unix timestamp in nanoseconds.Int64timezone— Optional. Timezone for the returned value.String
Returns a DateTime64 value with nanosecond precision. DateTime64(9)
fromUnixTimestamp64Second(value, timezone=None)
staticmethod
fromUnixTimestamp64Second(value[, timezone])
value— Unix timestamp in seconds.Int64timezone— Optional. Timezone for the returned value.String
Returns a DateTime64 value with second precision. DateTime64(0)
fromUnixTimestampInJodaSyntax(timestamp)
staticmethod
fromUnixTimestampInJodaSyntax(timestamp) fromUnixTimestampInJodaSyntax(timestamp, format[, timezone])
timestamp— Unix timestamp or date/time value.(U)Int*orDateorDate32orDateTimeorDateTime64format— Optional. Constant format string using Joda syntax for output formatting.Stringtimezone— Optional. Constant time zone string.String
Returns a date with time when called with one argument, or a String when called with two or three arguments.} DateTime or String
fuzzBits(s, p)
staticmethod
fuzzBits(s, p)
s— String or FixedString to perform bit fuzzing onStringorFixedStringp— Probability of flipping each bit as a number between0.0and1.0Float*
Returns a Fuzzed string with same type as s. String or FixedString
fuzzQuery(query)
staticmethod
gccMurmurHash(arg1, arg2=None)
staticmethod
gcd(x, y)
staticmethod
gcd(x, y)
x— First integer -y— Second integer The greatest common divisor ofxandy.
generateRandomStructure(number_of_columns=None, seed=None)
staticmethod
generateRandomStructure([number_of_columns, seed])
number_of_columns— The desired number of columns in the resultant table structure. If set to 0 orNull, the number of columns will be random from 1 to 128. Default value:Null.UInt64seed— Random seed to produce stable results. If seed is not specified or set toNull, it is randomly generated.UInt64
Randomly generated table structure. String
generateSerialID(series_identifier, start_value=None)
staticmethod
generateSerialID(series_identifier[, start_value])
series_identifier— Series identifierconst Stringstart_value— Optional. Starting value for the counter. Defaults to 0. Note: this value is only used when creating a new series and is ignored if the series already existsUInt*
Returns sequential numbers starting from the previous counter value. UInt64
generateSnowflakeID(expr=None, machine_id=None)
staticmethod
generateSnowflakeID([expr, [machine_id]])
expr— An arbitrary expression used to bypass common subexpression elimination if the function is called multiple times in a query. The value of the expression has no effect on the returned Snowflake ID. Optional. -machine_id— A machine ID, the lowest 10 bits are used. Int64. Optional. Returns the Snowflake ID.UInt64
generateULID(x=None)
staticmethod
generateULID([x])
x— Optional. An expression resulting in any of the supported data types. The resulting value is discarded, but the expression itself if used for bypassing common subexpression elimination if the function is called multiple times in one query.Any
Returns a ULID. FixedString(26)
generateUUIDv4(expr=None)
staticmethod
generateUUIDv4([expr])
expr— Optional. An arbitrary expression used to bypass common subexpression elimination if the function is called multiple times in a query. The value of the expression has no effect on the returned UUID. Returns a UUIDv4.UUID
generateUUIDv7(expr=None)
staticmethod
generateUUIDv7([expr])
expr— Optional. An arbitrary expression used to bypass common subexpression elimination if the function is called multiple times in a query. The value of the expression has no effect on the returned UUID.Any
Returns a UUIDv7. UUID
geoDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg)
staticmethod
geoDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg)
lon1Deg— Longitude of the first point in degrees. Range:[-180°, 180°].(U)Int*orFloat*orDecimallat1Deg— Latitude of the first point in degrees. Range:[-90°, 90°].(U)Int*orFloat*orDecimallon2Deg— Longitude of the second point in degrees. Range:[-180°, 180°].(U)Int*orFloat*orDecimallat2Deg— Latitude of the second point in degrees. Range:[-90°, 90°].(U)Int*orFloat*orDecimal
Returns the distance between two points on the Earth's surface, in meters Float64
geoToH3(lat, lon, resolution)
staticmethod
geoToS2(lon, lat)
staticmethod
geohashDecode(hash_str)
staticmethod
geohashDecode(hash_str)
hash_str— Geohash-encoded string to decode.StringorFixedString
Returns a tuple of (longitude, latitude) with Float64 precision. Tuple(Float64, Float64)
geohashEncode(longitude, latitude, precision=None)
staticmethod
geohashEncode(longitude, latitude, [precision])
longitude— Longitude part of the coordinate to encode. Range:[-180°, 180°].Float32orFloat64latitude— Latitude part of the coordinate to encode. Range:[-90°, 90°].Float32orFloat64precision— Optional. Length of the resulting encoded string. Default: 12. Range:[1, 12].(U)Int*
Returns an alphanumeric string of the encoded coordinate (modified version of the base32-encoding alphabet is used) String
geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)
staticmethod
geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precision)
longitude_min— Minimum longitude. Range:[-180°, 180°].Float32orFloat64latitude_min— Minimum latitude. Range:[-90°, 90°].Float32orFloat64longitude_max— Maximum longitude. Range:[-180°, 180°].Float32orFloat64latitude_max— Maximum latitude. Range:[-90°, 90°].Float32orFloat64precision— Geohash precision. Range:[1, 12].UInt8
Returns an array of precision-long strings of geohash-boxes covering the provided area, or an empty array if the minimum longitude and latitude values aren't less than the corresponding maximum values. Array(String)
getClientHTTPHeader(name)
staticmethod
getMacro(name)
staticmethod
getMacro(name)
name— The name of the macro to retrieve.const String
Returns the value of the specified macro. String
getMaxTableNameLengthForDatabase(database_name)
staticmethod
getMaxTableNameLengthForDatabase(database_name)
database_name— The name of the specified database.String
Returns the length of the maximum table name, an Integer
getMergeTreeSetting(setting_name)
staticmethod
getMergeTreeSetting(setting_name)
setting_name— The setting name.String
Returns the merge tree setting's current value.
getOSKernelVersion()
staticmethod
getOSKernelVersion()
Returns the current OS kernel version. String
getServerPort(port_name)
staticmethod
getServerSetting(setting_name)
staticmethod
getSetting(setting_name)
staticmethod
getSetting(setting_name)
setting_Name— The setting name.const String
Returns the setting's current value. Any
getSettingOrDefault(setting_name, default_value)
staticmethod
getSettingOrDefault(setting_name, default_value)
setting_name— The setting name.Stringdefault_value— Value to return if custom_setting is not set. Value may be of any data type or Null. Returns the current value of the specified setting ordefault_valueif the setting is not set.
getSizeOfEnumType(x)
staticmethod
getSubcolumn(nested_value, subcolumn_name)
staticmethod
getSubcolumn(nested_value, subcolumn_name)
getTypeSerializationStreams(col)
staticmethod
getTypeSerializationStreams(col)
col— Column or string representation of a data-type from which the data type will be detected.Any
Returns an array with all the serialization sub-stream paths. Array(String)
globalIn(x, set)
staticmethod
globalIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is in the set, 0 otherwise.UInt8
globalInIgnoreSet(x, set)
staticmethod
globalIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is in the set, 0 otherwise.UInt8
globalNotIn(x, set)
staticmethod
globalNotIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is not in the set, 0 otherwise.UInt8
globalNotInIgnoreSet(x, set)
staticmethod
globalNotIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is not in the set, 0 otherwise.UInt8
globalNotNullIn(x, set)
staticmethod
globalNotNullIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is not in the set, 0 otherwise.UInt8
globalNotNullInIgnoreSet(x, set)
staticmethod
globalNotNullIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is not in the set, 0 otherwise.UInt8
globalNullIn(x, set)
staticmethod
globalNullIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is in the set, 0 otherwise.UInt8
globalNullInIgnoreSet(x, set)
staticmethod
globalNullIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is in the set, 0 otherwise.UInt8
globalVariable(name)
staticmethod
greatCircleAngle(lon1Deg, lat1Deg, lon2Deg, lat2Deg)
staticmethod
greatCircleAngle(lon1Deg, lat1Deg, lon2Deg, lat2Deg)
lon1Deg— Longitude of the first point in degrees. Range:[-180°, 180°](U)Int*orFloat*orDecimallat1Deg— Latitude of the first point in degrees. Range:[-90°, 90°].(U)Int*orFloat*orDecimallon2Deg— Longitude of the second point in degrees. Range:[-180°, 180°].(U)Int*orFloat*orDecimallat2Deg— Latitude of the second point in degrees. Range:[-90°, 90°].(U)Int*orFloat*orDecimal
Returns the central angle between the two points in degrees Float64
greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg)
staticmethod
greatCircleDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg)
lon1Deg— Longitude of the first point in degrees. Range:[-180°, 180°].(U)Int*orFloat*orDecimallat1Deg— Latitude of the first point in degrees. Range:[-90°, 90°].(U)Int*orFloat*orDecimallon2Deg— Longitude of the second point in degrees. Range:[-180°, 180°].(U)Int*orFloat*orDecimallat2Deg— Latitude of the second point in degrees. Range:[-90°, 90°].(U)Int*orFloat*orDecimal
Returns the distance between two points on the Earth's surface, in meters Float64
greater(a, b)
staticmethod
greaterOrEquals(a, b)
staticmethod
greatest(x1, x2=None)
staticmethod
groupArray(x)
staticmethod
groupArrayInsertAt(default_x, size)
staticmethod
groupArrayIntersect(x)
staticmethod
groupArrayLast(max_size)
staticmethod
groupArrayMovingAvg(numbers_for_summing)
staticmethod
groupArrayMovingSum(numbers_for_summing)
staticmethod
groupArraySample(max_size, seed=None)
staticmethod
groupArraySorted(N)
staticmethod
groupBitAnd(expr)
staticmethod
groupBitOr(expr)
staticmethod
groupBitXor(expr)
staticmethod
groupBitmap(expr)
staticmethod
groupBitmapAnd(expr)
staticmethod
groupBitmapAnd(expr) groupBitmapAndState(expr)
expr— Expression that results in anAggregateFunction(groupBitmap, UInt*)type.AggregateFunction(groupBitmap, UInt*)
Returns a count of type UInt64, or a bitmap object when using -State. UInt64
groupBitmapOr(expr)
staticmethod
groupBitmapOr(expr) groupBitmapOrState(expr)
expr— Expression that results in anAggregateFunction(groupBitmap, UInt*)type.AggregateFunction(groupBitmap, UInt*)
Returns a count of type UInt64, or a bitmap object when using -State. UInt64
groupBitmapXor(expr)
staticmethod
groupBitmapXor(expr) groupBitmapXorState(expr)
expr— Expression that results in anAggregateFunction(groupBitmap, UInt*)type.AggregateFunction(groupBitmap, UInt*)
Returns a count of type UInt64, or a bitmap object when using -State. UInt64
groupConcat(delimiter, limit=None)
staticmethod
groupConcat(delimiter [, limit])
expression— The expression or column name that outputs strings to be concatenated.Stringdelimiter— A string that will be used to separate concatenated values. This parameter is optional and defaults to an empty string or delimiter from parameters if not specified.String
Returns a string consisting of the concatenated values of the column or expression. If the group has no elements or only null elements, and the function does not specify a handling for only null values, the result is a nullable string with a null value. String
groupNumericIndexedVector(*args)
staticmethod
groupUniqArray(x)
staticmethod
h3CellAreaM2(index)
staticmethod
h3CellAreaRads2(index)
staticmethod
h3Distance(start, end)
staticmethod
h3EdgeAngle(resolution)
staticmethod
h3EdgeLengthKm(resolution)
staticmethod
h3EdgeLengthM(resolution)
staticmethod
h3ExactEdgeLengthKm(index)
staticmethod
h3ExactEdgeLengthM(index)
staticmethod
h3ExactEdgeLengthRads(index)
staticmethod
h3GetBaseCell(index)
staticmethod
h3GetDestinationIndexFromUnidirectionalEdge(edge)
staticmethod
h3GetFaces(index)
staticmethod
h3GetFaces(index)
index— Hexagon index number.UInt64
Returns an array containing the indices (0-19) of the icosahedron faces that the H3 index intersects with. Array(UInt8)
h3GetIndexesFromUnidirectionalEdge(edge)
staticmethod
h3GetIndexesFromUnidirectionalEdge(edge)
edge— Hexagon index number that represents a unidirectional edge.UInt64
Returns a tuple containing the origin and destination hexagon indices from the unidirectional edge, or (0,0) if the input is not valid. Tuple(UInt64, UInt64)
h3GetOriginIndexFromUnidirectionalEdge(edge)
staticmethod
h3GetPentagonIndexes(resolution)
staticmethod
h3GetPentagonIndexes(resolution)
resolution— Index resolution with range[0, 15].UInt8
Returns an array of all pentagon H3 indices at the specified resolution. Array(UInt64)
h3GetRes0Indexes()
staticmethod
h3GetRes0Indexes()
Returns an array of all resolution 0 H3 indices. Array(UInt64)
h3GetResolution(index)
staticmethod
h3GetUnidirectionalEdge(origin, destination)
staticmethod
h3GetUnidirectionalEdgeBoundary(index)
staticmethod
h3GetUnidirectionalEdgeBoundary(index)
index— Hexagon index number that represents a unidirectional edge.UInt64
Returns an array of (longitude, latitude) pairs defining a unidirectional edge. Array(Float64, Float64)
h3GetUnidirectionalEdgesFromHexagon(index)
staticmethod
h3GetUnidirectionalEdgesFromHexagon(index)
index— Hexagon index number that represents a cell.UInt64
Returns an array of H3 indexes representing each unidirectional edge. Array(UInt64)
h3HexAreaKm2(resolution)
staticmethod
h3HexAreaM2(resolution)
staticmethod
h3HexRing(index, k)
staticmethod
h3HexRing(index, k)
index— Hexagon index number that represents the origin.UInt64k— Distance from the origin (ring size).UInt16
Returns an array of H3 indices forming a hexagonal ring around the origin, or 0 if a pentagonal distortion is encountered. Array(UInt64)
h3IndexesAreNeighbors(index1, index2)
staticmethod
h3IsPentagon(index)
staticmethod
h3IsResClassIII(index)
staticmethod
h3IsValid(h3index)
staticmethod
h3Line(start, end)
staticmethod
h3Line(start, end)
start— Hexagon index number that represents the starting point.UInt64end— Hexagon index number that represents the ending point.UInt64
Returns an array of H3 indices representing the line between the start and end indices. Array(UInt64)
h3NumHexagons(resolution)
staticmethod
h3PointDistKm(lat1, lon1, lat2, lon2)
staticmethod
h3PointDistM(lat1, lon1, lat2, lon2)
staticmethod
h3PointDistRads(lat1, lon1, lat2, lon2)
staticmethod
h3PolygonToCells(geometry, resolution)
staticmethod
h3PolygonToCells(geometry, resolution)
h3ToCenterChild(index, resolution)
staticmethod
h3ToChildren(index, resolution)
staticmethod
h3ToChildren(index, resolution)
index— Parent H3 index.UInt64resolution— Resolution of the child indexes with range[0, 15].UInt8
Returns an array of child H3 indexes at the specified resolution. Array(UInt64)
h3ToGeo(h3Index)
staticmethod
h3ToGeo(h3Index)
h3Index— H3 index.UInt64
Returns a tuple consisting of two values (lat, lon) where lat is latitude and lon is longitude. Tuple(Float64, Float64)
h3ToGeoBoundary(h3Index)
staticmethod
h3ToGeoBoundary(h3Index)
h3Index— H3 index.UInt64
Returns an array of coordinate pairs (lat, lon) that define the boundary of the H3 hexagon. Array(Tuple(Float64, Float64))
h3ToParent(index, resolution)
staticmethod
h3ToString(index)
staticmethod
h3UnidirectionalEdgeIsValid(index)
staticmethod
h3kRing(h3index, k)
staticmethod
h3kRing(h3index, k)
Returns an array of H3 indexes that are within k rings of the origin hexagon. Array(UInt64)
halfMD5(arg1, arg2=None, argN=None)
staticmethod
has(haystack, needle)
staticmethod
hasAll(set, subset)
staticmethod
hasAll(set, subset)
set— Array of any type with a set of elements.Array(T)-
subset— Array of any type that shares a common supertype withsetcontaining elements that should be tested to be a subset ofset.Array(T) -
1, ifsetcontains all of the elements fromsubset. 0, otherwise.
Raises a NO_COMMON_TYPE exception if the set and subset elements do not share a common supertype.
hasAllTokens(input, needles)
staticmethod
hasAllTokens(input, needles)
input— The input column.StringorFixedStringorArray(String)orArray(FixedString)needles— Tokens to be searched.StringorArray(String)tokenizer— The tokenizer to use. Valid arguments aresplitByNonAlpha,ngrams,splitByString,array, andsparseGrams. Optional, if not set explicitly, defaults tosplitByNonAlpha.const String
Returns 1, if all needles match. 0, otherwise. UInt8
hasAny(arr_x, arr_y)
staticmethod
hasAny(arr_x, arr_y)
arr_x— Array of any type with a set of elements.Array(T)-
arr_y— Array of any type that shares a common supertype with arrayarr_x.Array(T) -
1, ifarr_xandarr_yhave one similar element at least. 0, otherwise.
Raises a NO_COMMON_TYPE exception if any of the elements of the two arrays do not share a common supertype.
hasAnyTokens(input, needles)
staticmethod
hasAnyTokens(input, needles)
input— The input column.StringorFixedStringorNullable(String)orNullable(FixedString)orArray(String)orArray(FixedString)orArray(Nullable(String))orArray(Nullable(FixedString))needles— Tokens to be searched.StringorArray(String)tokenizer— The tokenizer to use. Valid arguments aresplitByNonAlpha,ngrams,splitByString,array, andsparseGrams. Optional, if not set explicitly, defaults tosplitByNonAlpha.const String
Returns 1, if there was at least one match. 0, otherwise. UInt8
hasColumnInTable(hostname=None, username=None, password=None, database=None, table=None, column=None)
staticmethod
hasColumnInTable([hostname[, username[, password]],]database, table, column)
database— Name of the database.const Stringtable— Name of the table.const Stringcolumn— Name of the column.const Stringhostname— Optional. Remote server name to perform the check on.const Stringusername— Optional. Username for remote server.const Stringpassword— Optional. Password for remote server.const String
Returns 1 if the given column exists, 0 otherwise. UInt8
hasSubsequence(haystack, needle)
staticmethod
hasSubsequenceCaseInsensitive(haystack, needle)
staticmethod
hasSubsequenceCaseInsensitiveUTF8(haystack, needle)
staticmethod
hasSubsequenceUTF8(haystack, needle)
staticmethod
hasSubstr(arr1, arr2)
staticmethod
hasThreadFuzzer()
staticmethod
hasThreadFuzzer()
Returns whether Thread Fuzzer is effective. UInt8
hasToken(haystack, token)
staticmethod
hasToken(haystack, token)
haystack— String to be searched.Stringtoken— Token to search for.const String
Returns 1 if the token is found, 0 otherwise. UInt8
hasTokenCaseInsensitive(haystack, needle)
staticmethod
hasTokenCaseInsensitive(haystack, needle)
hasTokenCaseInsensitiveOrNull(haystack, needle)
staticmethod
hasTokenCaseInsensitiveOrNull(haystack, needle)
hasTokenOrNull(haystack, token)
staticmethod
hasTokenOrNull(haystack, token)
haystack— String to be searched. Must be constant.Stringtoken— Token to search for.const String
Returns 1 if the token is found, 0 otherwise, null if token is ill-formed. Nullable(UInt8)
hex(arg)
staticmethod
hilbertDecode(tuple_size, code)
staticmethod
hilbertDecode(tuple_size, code)
tuple_size— Integer value of no more than2.UInt8/16/32/64orTuple(UInt8/16/32/64)code—UInt64code.UInt64
Returns a tuple of the specified size. Tuple(UInt64)
hilbertEncode(args)
staticmethod
-- Simplified mode hilbertEncode(args)
-- Expanded mode hilbertEncode(range_mask, args)
args— Up to twoUIntvalues or columns of typeUInt.UInt8/16/32/64range_mask— For the expanded mode, up to twoUIntvalues or columns of typeUInt.UInt8/16/32/64
Returns a UInt64 code. UInt64
histogram(*args)
staticmethod
hiveHash(arg)
staticmethod
hop(time_attr, hop_interval, window_interval, timezone=None)
staticmethod
hop(time_attr, hop_interval, window_interval[, timezone])
time_attr— Date and time.DateTimehop_interval— Positive Hop interval.Intervalwindow_interval— Positive Window interval.Intervaltimezone— Optional. Timezone name.String
Returns the inclusive lower and exclusive upper bound of the corresponding hopping window. Tuple(DateTime, DateTime)
hopEnd(time_attr, hop_interval, window_interval, timezone=None)
staticmethod
hopEnd(time_attr, hop_interval, window_interval[, timezone])
time_attr— Date and time.DateTimehop_interval— Positive Hop interval.Intervalwindow_interval— Positive Window interval.Intervaltimezone— Optional. Timezone name.String
Returns the exclusive upper bound of the corresponding hopping window. DateTime
hopStart(time_attr, hop_interval, window_interval, timezone=None)
staticmethod
hopStart(time_attr, hop_interval, window_interval[, timezone])
time_attr— Date and time.DateTimehop_interval— Positive Hop interval.Intervalwindow_interval— Positive Window interval.Intervaltimezone— Optional. Timezone name.String
Returns the inclusive lower bound of the corresponding hopping window. DateTime
hostName()
staticmethod
hostName()
Returns the host name. String
hypot(x, y)
staticmethod
icebergBucket(N, value)
staticmethod
icebergHash(value)
staticmethod
icebergTruncate(N, value)
staticmethod
idnaDecode(s)
staticmethod
idnaEncode(s)
staticmethod
ifNotFinite(x, y)
staticmethod
ifNull(x, alt)
staticmethod
if_(cond, then, else_)
staticmethod
if(cond, then, else)
cond— The evaluated condition.UInt8orNullable(UInt8)orNULLthen— The expression returned ifcondis true. -else— The expression returned ifcondis false orNULL. The result of either thethenorelseexpressions, depending on conditioncond.
ignore(x)
staticmethod
ilike(haystack, pattern)
staticmethod
ilike(haystack, pattern) -- haystack ILIKE pattern
haystack— String in which the search is performed.StringorFixedStringpattern— LIKE pattern to match against.String
Returns 1 if the string matches the LIKE pattern (case-insensitive), otherwise 0. UInt8
inIgnoreSet(x, set)
staticmethod
in(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is in the set, 0 otherwise.UInt8
in_(x, set)
staticmethod
in(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is in the set, 0 otherwise.UInt8
indexHint(expression)
staticmethod
indexHint(expression)
expression— Any expression for index range selection.Expression
Returns 1 in all cases. UInt8
indexOf(arr, x)
staticmethod
indexOfAssumeSorted(arr, x)
staticmethod
initcap(s)
staticmethod
initcapUTF8(s)
staticmethod
initialQueryID()
staticmethod
initialQueryID()
Returns the ID of the initial current query. String
initialQueryStartTime()
staticmethod
initialQueryStartTime()
Returns the start time of the initial current query. DateTime
initializeAggregation(aggregate_function, arg1, arg2=None)
staticmethod
initializeAggregation(aggregate_function, arg1[, arg2, ...])
aggregate_function— Name of the aggregation function to initialize.Stringarg1[, arg2, ...]— Arguments of the aggregate function.Any
Returns the result of aggregation for every row passed to the function. The return type is the same as the return type of the function that initializeAggregation takes as a first argument. Any
intDiv(x, y)
staticmethod
intDiv(x, y)
x— Left hand operand. -y— Right hand operand. Result of integer division ofxandy
intDivOrNull(x, y)
staticmethod
intDivOrZero(a, b)
staticmethod
intHash32(arg)
staticmethod
intervalLengthSum(start, end)
staticmethod
intervalLengthSum(start, end)
start— The starting value of the interval.(U)Int32/64orFloat*orDateTimeorDateend— The ending value of the interval.(U)Int32/64orFloat*orDateTimeorDate
Returns the total length of union of all ranges (segments on numeric axis). Depending on the type of the argument, the return value may be UInt64 or Float64 type. UInt64 or Float64
isConstant(x)
staticmethod
isDecimalOverflow(value, precision=None)
staticmethod
isDecimalOverflow(value[, precision])
value— Decimal value to check.Decimalprecision— Optional. The precision of the Decimal type. If omitted, the initial precision of the first argument is used.UInt8
Returns 1 if the decimal value has more digits than allowed by its precision, 0 if the decimal value satisfies the specified precision. UInt8
isDistinctFrom(x, y)
staticmethod
isDistinctFrom(x, y)
x— First value to compare. Can be any ClickHouse data type.Anyy— Second value to compare. Can be any ClickHouse data type.Any
Returns true if the two values are different, treating NULLs as comparable:
- Returns true if x != y.
- Returns true if exactly one of x or y is NULL.
- Returns false if x = y, or both x and y are NULL. Bool
isDynamicElementInSharedData(dynamic)
staticmethod
isFinite(x)
staticmethod
isFinite(x)
x— Number to check for finiteness.Float*
1 if x is not infinite and not NaN, otherwise 0.
isIPAddressInRange(address, prefix)
staticmethod
isIPv4String(string)
staticmethod
isIPv6String(string)
staticmethod
isInfinite(x)
staticmethod
isInfinite(x)
x— Number to check for infiniteness.Float*
1 if x is infinite, otherwise 0 (including for NaN).
isMergeTreePartCoveredBy(nested_part, covering_part)
staticmethod
isNaN(x)
staticmethod
isNotDistinctFrom(x, y)
staticmethod
isNotDistinctFrom(x, y)
x— First value to compare. Can be any ClickHouse data type.Anyy— Second value to compare. Can be any ClickHouse data type.Any
Returns true if the two values are equal, treating NULLs as comparable:
- Returns true if x = y.
- Returns true if both x and y are NULL.
- Returns false if x != y, or exactly one of x or y is NULL. Bool
isNotNull(x)
staticmethod
isNull(x)
staticmethod
isNullable(x)
staticmethod
isValidASCII(str)
staticmethod
isValidASCII(str)
isValidJSON(json)
staticmethod
isValidUTF8(s)
staticmethod
isZeroOrNull(x)
staticmethod
isZeroOrNull(x)
x— A numeric value.UInt
Returns 1 if x is NULL or equal to zero, otherwise 0. UInt8/16/32/64 or Float32/Float64
jaroSimilarity(s1, s2)
staticmethod
jaroWinklerSimilarity(s1, s2)
staticmethod
javaHash(arg)
staticmethod
javaHashUTF16LE(arg)
staticmethod
joinGet(join_storage_table_name, value_column, join_keys)
staticmethod
joinGet(join_storage_table_name, value_column, join_keys)
join_storage_table_name— An identifier which indicates where to perform the search. The identifier is searched in the default database (see parameterdefault_databasein the config file). To override the default database, use theUSE database_namequery or specify the database and the table through a dot, likedatabase_name.table_name.Stringvalue_column— The name of the column of the table that contains required data.const Stringjoin_keys— A list of join keys.Any
Returns list of values corresponded to list of keys. Any
joinGetOrNull(join_storage_table_name, value_column, join_keys)
staticmethod
joinGetOrNull(join_storage_table_name, value_column, join_keys)
join_storage_table_name— An identifier which indicates where to perform the search. The identifier is searched in the default database (see parameter default_database in the config file). To override the default database, use theUSE database_namequery or specify the database and the table through a dot, likedatabase_name.table_name.Stringvalue_column— The name of the column of the table that contains required data.const Stringjoin_keys— A list of join keys.Any
Returns a list of values corresponding to the list of keys, or NULL if a key is not found. Any
jumpConsistentHash(key, buckets)
staticmethod
kafkaMurmurHash(arg1, arg2=None)
staticmethod
keccak256(message)
staticmethod
keccak256(message)
message— The input string to hash.String
Returns the 32-byte Keccak-256 hash of the input string as a fixed-length string. FixedString(32)
kolmogorovSmirnovTest(alternative=None, computation_method=None)
staticmethod
kolmogorovSmirnovTest([alternative, computation_method])(sample_data, sample_index)
Returns a tuple with two elements: a calculated statistic and a calculated p-value. Tuple(Float64, Float64)
kostikConsistentHash(input, n)
staticmethod
kql_array_sort_asc(array1, array2=None, nulls_last=None)
staticmethod
kql_array_sort_asc(array1[, array2, ..., nulls_last])
array1— The array to sort.Array(T)array2— Optional. Additional arrays to reorder according to array1's sort order.Array(T)nulls_last— Optional. A boolean indicating whether nulls should appear last. Default is true.UInt8
Returns a tuple of arrays sorted in ascending order. Tuple(Array, ...)
kql_array_sort_desc(array1, array2=None, nulls_last=None)
staticmethod
kql_array_sort_desc(array1[, array2, ..., nulls_last])
array1— The array to sort.Array(T)array2— Optional additional arrays to reorder according to array1's sort order.Array(T)nulls_last— Optional boolean indicating whether nulls should appear last. Default is true.UInt8
Returns a tuple of arrays sorted in descending order. Tuple(Array, ...)
kurtPop(expr)
staticmethod
kurtPop(expr)
expr— Expression returning a number.(U)Int*orFloat*orDecimal
Returns the kurtosis of the given distribution. Float64
kurtSamp(expr)
staticmethod
kurtSamp(expr)
expr— Expression returning a number.(U)Int*orFloat*orDecimal
Returns the kurtosis of the given distribution. If n <= 1 (n is a size of the sample), then the function returns nan. Float64
lag(*args)
staticmethod
lagInFrame(*args)
staticmethod
largestTriangleThreeBuckets(n)
staticmethod
largestTriangleThreeBuckets(n)(x, y)
x— x coordinate.(U)Int*orFloat*orDecimalorDateorDate32orDateTimeorDateTime64y— y coordinate.(U)Int*orFloat*orDecimalorDateorDate32orDateTimeorDateTime64
Returns an array of tuples with two elements.. Array(Tuple(Float64, Float64))
lcm(x, y)
staticmethod
lead(*args)
staticmethod
leadInFrame(*args)
staticmethod
least(x1, x2=None)
staticmethod
left(s, offset)
staticmethod
left(s, offset)
s— The string to calculate a substring from.StringorFixedStringoffset— The number of bytes of the offset.(U)Int*
Returns:
- For positive offset, a substring of s with offset many bytes, starting from the left of the string.
- For negative offset, a substring of s with length(s) - |offset| bytes, starting from the left of the string.
- An empty string if length is 0.
String
leftPad(string, length, pad_string=None)
staticmethod
leftPad(string, length[, pad_string])
string— Input string that should be padded.Stringlength— The length of the resulting string. If the value is smaller than the input string length, then the input string is shortened tolengthcharacters.(U)Int*pad_string— Optional. The string to pad the input string with. If not specified, then the input string is padded with spaces.String
Returns a left-padded string of the given length. String
leftPadUTF8(string, length, pad_string=None)
staticmethod
leftPadUTF8(string, length[, pad_string])
string— Input string that should be padded.Stringlength— The length of the resulting string. If the value is smaller than the input string length, then the input string is shortened tolengthcharacters.(U)Int*pad_string— Optional. The string to pad the input string with. If not specified, then the input string is padded with spaces.String
Returns a left-padded string of the given length. String
leftUTF8(s, offset)
staticmethod
leftUTF8(s, offset)
- `s` — The UTF-8 encoded string to calculate a substring from. [`String`](https://clickhouse.com/docs/sql-reference/data-types/string) or [`FixedString`](https://clickhouse.com/docs/sql-reference/data-types/fixedstring)
- `offset` — The number of bytes of the offset. [`(U)Int*`](https://clickhouse.com/docs/sql-reference/data-types/int-uint)
Returns:
- For positive `offset`, a substring of `s` with `offset` many bytes, starting from the left of the string.
"
- For negative offset, a substring of s with length(s) - |offset| bytes, starting from the left of the string.
"
- An empty string if length is 0.
String
lemmatize(lang, word)
staticmethod
length(x)
staticmethod
length(x)
x— Value for which to calculate the number of bytes (for String/FixedString) or elements (for Array).StringorFixedStringorArray(T)
Returns the number of number of bytes in the String/FixedString x / the number of elements in array x UInt64
lengthUTF8(s)
staticmethod
less(a, b)
staticmethod
lessOrEquals(a, b)
staticmethod
lgamma(x)
staticmethod
like(haystack, pattern)
staticmethod
like(haystack, pattern) -- haystack LIKE pattern
haystack— String in which the search is performed.StringorFixedStringpattern—LIKEpattern to match against. Can contain%(matches any number of characters),_(matches single character), and\for escaping.String
Returns 1 if the string matches the LIKE pattern, otherwise 0. UInt8
locate(needle, haystack, start_pos=None)
staticmethod
locate(needle, haystack[, start_pos])
needle— Substring to be searched.Stringhaystack— String in which the search is performed.StringorEnumstart_pos— Optional. Position (1-based) inhaystackat which the search starts.UInt
Returns starting position in bytes and counting from 1, if the substring was found, 0, if the substring was not found. UInt64
log(x)
staticmethod
log10(x)
staticmethod
log1p(x)
staticmethod
log2(x)
staticmethod
logTrace(message)
staticmethod
logTrace(message)
message— Message that is emitted to the server log.const String
Returns 0 always. UInt8
lowCardinalityIndices(col)
staticmethod
lowCardinalityIndices(col)
col— A low cardinality column.LowCardinality
The position of the value in the dictionary of the current part. UInt64
lowCardinalityKeys(col)
staticmethod
lowCardinalityKeys(col)
col— A low cardinality column.LowCardinality
Returns the dictionary keys. UInt64
lower(s)
staticmethod
lowerUTF8(input)
staticmethod
makeDate(year, month, day)
staticmethod
makeDate(year, month, day) makeDate(year, day_of_year)
year— Year number.(U)Int*orFloat*orDecimalmonth— Month number (1-12).(U)Int*orFloat*orDecimalday— Day of the month (1-31).(U)Int*orFloat*orDecimalday_of_year— Day of the year (1-365).(U)Int*orFloat*orDecimal
Returns a Date value constructed from the provided arguments Date
makeDate32(year, month, day)
staticmethod
makeDate32(year, month, day) makeDate32(year, day_of_year)
year— Year number.(U)Int*orFloat*orDecimalmonth— Month number (1-12).(U)Int*orFloat*orDecimalday— Day of the month (1-31).(U)Int*orFloat*orDecimalday_of_year— Day of the year (1-365).(U)Int*orFloat*orDecimal
Returns a Date32 value constructed from the provided arguments Date32
makeDateTime(year, month, day, hour, minute, second, timezone=None)
staticmethod
makeDateTime(year, month, day, hour, minute, second[, timezone])
year— Year number.(U)Int*orFloat*orDecimalmonth— Month number (1-12).(U)Int*orFloat*orDecimalday— Day of the month (1-31).(U)Int*orFloat*orDecimalhour— Hour (0-23).(U)Int*orFloat*orDecimalminute— Minute (0-59).(U)Int*orFloat*orDecimalsecond— Second (0-59).(U)Int*orFloat*orDecimaltimezone— Timezone name.String
Returns a DateTime value constructed from the provided arguments DateTime
makeDateTime64(year, month, day, hour, minute, second, fraction=None, precision=None, timezone=None)
staticmethod
makeDateTime64(year, month, day, hour, minute, second[, fraction[, precision[, timezone]]])
year— Year number.(U)Int*orFloat*orDecimalmonth— Month number (1-12).(U)Int*orFloat*orDecimalday— Day of the month (1-31).(U)Int*orFloat*orDecimalhour— Hour (0-23).(U)Int*orFloat*orDecimalminute— Minute (0-59).(U)Int*orFloat*orDecimalsecond— Second (0-59).(U)Int*orFloat*orDecimalfraction— Fractional part of the second.(U)Int*orFloat*orDecimalprecision— Precision for the fractional part (0-9).UInt8timezone— Timezone name.String
Returns a DateTime64 value constructed from the provided arguments DateTime64
mannWhitneyUTest(alternative, continuity_correction=None)
staticmethod
mannWhitneyUTest(alternative[, continuity_correction])
Returns a tuple with two elements: calculated U-statistic and calculated p-value. Tuple(Float64, Float64)
map(key1, value1, key2=None, value2=None)
staticmethod
map(key1, value1[, key2, value2, ...])
Returns a map containing key:value pairs. Map(Any, Any)
mapAdd(arg1, arg2=None)
staticmethod
mapAdd(arg1[, arg2, ...])
arg1[, 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))
Returns a map or returns a tuple, where the first array contains the sorted keys and the second array contains values. Map(K, V) or Tuple(Array(T), Array(T))
mapAll(func=None, map=None)
staticmethod
mapAll([func,] map)
func— Lambda function.Lambda functionmap— Map to check.Map(K, V)
Returns 1 if all key-value pairs satisfy the condition, 0 otherwise. UInt8
mapApply(func, map)
staticmethod
mapApply(func, map)
func— Lambda function.Lambda functionmap— Map to apply function to.Map(K, V)
Returns a new map obtained from the original map by application of func for each element. Map(K, V)
mapConcat(maps)
staticmethod
mapContainsKey(map, key)
staticmethod
mapContainsKeyLike(map, pattern)
staticmethod
mapContainsKeyLike(map, pattern)
map— Map to search in.Map(K, V)pattern— Pattern to match keys against.const String
Returns 1 if map contains a key matching pattern, 0 otherwise. UInt8
mapContainsValue(map, value)
staticmethod
mapContainsValueLike(map, pattern)
staticmethod
mapContainsValueLike(map, pattern)
map— Map to search in.Map(K, V)pattern— Pattern to match values against.const String
Returns 1 if map contains a value matching pattern, 0 otherwise. UInt8
mapExists(func=None, map=None)
staticmethod
mapExists([func,] map)
func— Optional. Lambda function.Lambda functionmap— Map to check.Map(K, V)
Returns 1 if at least one key-value pair satisfies the condition, 0 otherwise. UInt8
mapExtractKeyLike(map, pattern)
staticmethod
mapExtractKeyLike(map, pattern)
map— Map to extract from.Map(K, V)pattern— Pattern to match keys against.const String
Returns a map containing elements the key matching the specified pattern. If no elements match the pattern, an empty map is returned. Map(K, V)
mapExtractValueLike(map, pattern)
staticmethod
mapExtractValueLike(map, pattern)
map— Map to extract from.Map(K, V)pattern— Pattern to match values against.const String
Returns a map containing elements the value matching the specified pattern. If no elements match the pattern, an empty map is returned. Map(K, V)
mapFilter(func, map)
staticmethod
mapFilter(func, map)
func— Lambda function.Lambda functionmap— Map to filter.Map(K, V)
Returns a map containing only the elements in the map for which func returns something other than 0. Map(K, V)
mapFromArrays(keys, values)
staticmethod
mapKeys(map)
staticmethod
mapPartialReverseSort(func=None, limit=None, map=None)
staticmethod
mapPartialReverseSort([func,] limit, map)
func— Optional. Lambda function.Lambda functionlimit— Elements in the range[1..limit]are sorted.(U)Int*map— Map to sort.Map(K, V)
Returns a partially sorted map in descending order. Map(K, V)
mapPartialSort(func=None, limit=None, map=None)
staticmethod
mapPartialSort([func,] limit, map)
func— Optional. Lambda function.Lambda functionlimit— Elements in the range[1..limit]are sorted.(U)Int*map— Map to sort.Map(K, V)
Returns a partially sorted map. Map(K, V)
mapPopulateSeries(map, max=None)
staticmethod
mapPopulateSeries(map[, max]) | mapPopulateSeries(keys, values[, max])
map— 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
Returns a map or a tuple of two arrays where the first has keys in sorted order, and the second values for the corresponding keys. Map(K, V) or Tuple(Array(UInt*), Array(Any))
mapReverseSort(func=None, map=None)
staticmethod
mapReverseSort([func,] map)
func— Optional. Lambda function.Lambda functionmap— Map to sort.Map(K, V)
Returns a map sorted in descending order. Map(K, V)
mapSort(func=None, map=None)
staticmethod
mapSort([func,] map)
func— Optional. Lambda function.Lambda functionmap— Map to sort.Map(K, V)
Returns a map sorted in ascending order. Map(K, V)
mapSubtract(arg1, arg2=None)
staticmethod
mapSubtract(arg1[, arg2, ...])
arg1[, 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))
Returns one map or tuple, where the first array contains the sorted keys and the second array contains values. Map(K, V) or Tuple(Array(T), Array(T))
mapUpdate(map1, map2)
staticmethod
mapValues(map)
staticmethod
match(haystack, pattern)
staticmethod
match(haystack, pattern)
haystack— String in which the pattern is searched.Stringpattern— Regular expression pattern.const String
Returns 1 if the pattern matches, 0 otherwise. UInt8
materialize(x)
staticmethod
max(column)
staticmethod
max2(x, y)
staticmethod
max2(x, y)
x— First value(U)Int8/16/32/64orFloat*orDecimaly— Second value(U)Int8/16/32/64orFloat*orDecimal
Returns the bigger value of x and y. Float64
maxIntersections(start_column, end_column)
staticmethod
maxIntersections(start_column, end_column)
start_column— A numeric column that represents the start of each interval. Ifstart_columnisNULLor 0 then the interval will be skipped.(U)Int*orFloat*end_column— A numeric column that represents the end of each interval. Ifend_columnisNULLor 0 then the interval will be skipped.(U)Int*orFloat*
Returns the maximum number of intersected intervals. UInt64
maxIntersectionsPosition(start_column, end_column)
staticmethod
maxIntersectionsPosition(start_column, end_column)
start_column— A numeric column that represents the start of each interval. Ifstart_columnisNULLor 0 then the interval will be skipped.(U)Int*orFloat*end_column— A numeric column that represents the end of each interval. Ifend_columnisNULLor 0 then the interval will be skipped.(U)Int*orFloat*
Returns the start positions of the maximum number of intersected intervals. Any
maxMappedArrays(key, value)
staticmethod
maxMappedArrays(key, value) maxMappedArrays(Tuple(key, value))
Returns a tuple of two arrays: keys in sorted order, and values calculated for the corresponding keys. Tuple(Array(T), Array(T))
meanZTest(population_variance_x, population_variance_y, confidence_level)
staticmethod
meanZTest(population_variance_x, population_variance_y, confidence_level)(sample_data, sample_index)
Returns a tuple with four elements: calculated z-statistic, calculated p-value, calculated confidence-interval-low, calculated confidence-interval-high. Tuple(Float64, Float64, Float64, Float64)
mergeTreePartInfo(part_name)
staticmethod
metroHash64(arg1, arg2=None)
staticmethod
midpoint(x1, x2=None)
staticmethod
midpoint(x1[, x2, ...])
x1[, x2, ...]— Accepts a single value or multiple values for averaging. Returns the average value of the provided arguments, promoted to the largest compatible type.
min(column)
staticmethod
min2(x, y)
staticmethod
min2(x, y)
x— First value(U)Int8/16/32/64orFloat*orDecimaly— Second value(U)Int8/16/32/64orFloat*orDecimal
Returns the smaller value of x and y. Float64
minMappedArrays(key, value)
staticmethod
minMappedArrays(key, value) minMappedArrays(Tuple(key, value))
Returns a tuple of two arrays: keys in sorted order, and values calculated for the corresponding keys. Tuple(Array(T), Array(T))
minSampleSizeContinuous(baseline, sigma, mde, power, alpha)
staticmethod
minSampleSizeContinuous(baseline, sigma, mde, power, alpha)
baseline— Baseline value of a metric.(U)Int*orFloat*sigma— Baseline standard deviation of a metric.(U)Int*orFloat*mde— Minimum detectable effect (MDE) as percentage of the baseline value (e.g. for a baseline value 112.25 the MDE 0.03 means an expected change to 112.25 ± 112.25*0.03).(U)Int*orFloat*power— Required statistical power of a test (1 - probability of Type II error).(U)Int*orFloat*alpha— Required significance level of a test (probability of Type I error).(U)Int*orFloat*
Returns a named Tuple with 3 elements: minimum_sample_size, detect_range_lower and detect_range_upper. These are respectively: the required sample size, the lower bound of the range of values not detectable with the returned required sample size, calculated as baseline * (1 - mde), and the upper bound of the range of values not detectable with the returned required sample size, calculated as baseline * (1 + mde) (Float64). Tuple(Float64, Float64, Float64)
minSampleSizeConversion(baseline, mde, power, alpha)
staticmethod
minSampleSizeConversion(baseline, mde, power, alpha)
baseline— Baseline conversion.Float*mde— Minimum detectable effect (MDE) as percentage points (e.g. for a baseline conversion 0.25 the MDE 0.03 means an expected change to 0.25 ± 0.03).Float*power— Required statistical power of a test (1 - probability of Type II error).Float*alpha— Required significance level of a test (probability of Type I error).Float*
Returns a named Tuple with 3 elements: minimum_sample_size, detect_range_lower, detect_range_upper. These are, respectively: the required sample size, the lower bound of the range of values not detectable with the returned required sample size, calculated as baseline - mde, the upper bound of the range of values not detectable with the returned required sample size, calculated as baseline + mde. Tuple(Float64, Float64, Float64)
minus(x, y)
staticmethod
minus(x, y)
x— Minuend. -y— Subtrahend. x minus y
modulo(a, b)
staticmethod
modulo(a, b)
a— The dividend -b— The divisor (modulus) The remainder of a % b
moduloLegacy(a, b)
staticmethod
moduloOrNull(x, y)
staticmethod
moduloOrZero(a, b)
staticmethod
monthName(datetime)
staticmethod
monthName(datetime)
datetime— Date or date with time.DateorDate32orDateTimeorDateTime64
Returns the name of the month. String
mortonDecode(tuple_size, code)
staticmethod
-- Simple mode mortonDecode(tuple_size, code)
-- Expanded mode mortonDecode(range_mask, code)
tuple_size— Integer value no more than 8.UInt8/16/32/64range_mask— For the expanded mode, the mask for each argument. The mask is a tuple of unsigned integers. Each number in the mask configures the amount of range shrink.Tuple(UInt8/16/32/64)code— UInt64 code.UInt64
Returns a tuple of the specified size. Tuple(UInt64)
mortonEncode(args)
staticmethod
-- Simplified mode mortonEncode(args)
-- Expanded mode mortonEncode(range_mask, args)
args— Up to 8 unsigned integers or columns of the aforementioned type.UInt8/16/32/64range_mask— For the expanded mode, the mask for each argument. The mask is a tuple of unsigned integers from1-8. Each number in the mask configures the amount of range shrink.Tuple(UInt8/16/32/64)
Returns a UInt64 code. UInt64
multiFuzzyMatchAllIndices(haystack, distance, pattern1=None, pattern2=None, patternN=None)
staticmethod
multiFuzzyMatchAllIndices(haystack, distance, [pattern1, pattern2, ..., patternN])
haystack— String in which the search is performed.Stringdistance— The maximum edit distance for fuzzy matching.UInt8pattern— Array of patterns to match against.Array(String)
Returns an array of all indices (starting from 1) that match the haystack within the specified edit distance in any order. Returns an empty array if no matches are found. Array(UInt64)
multiFuzzyMatchAny(haystack, distance, pattern1=None, pattern2=None, patternN=None)
staticmethod
multiFuzzyMatchAny(haystack, distance, [pattern1, pattern2, ..., patternN])
haystack— String in which the search is performed.Stringdistance— The maximum edit distance for fuzzy matching.UInt8pattern— Optional. An array of patterns to match against.Array(String)
Returns 1 if any pattern matches the haystack within the specified edit distance, otherwise 0. UInt8
multiFuzzyMatchAnyIndex(haystack, distance, pattern1=None, pattern2=None, patternn=None)
staticmethod
multiFuzzyMatchAnyIndex(haystack, distance, [pattern1, pattern2, ..., patternn])
haystack— String in which the search is performed.Stringdistance— The maximum edit distance for fuzzy matching.UInt8pattern— Array of patterns to match against.Array(String)
Returns the index (starting from 1) of any pattern that matches the haystack within the specified edit distance, otherwise 0. UInt64
multiIf(cond_1, then_1, cond_2, then_2, else_)
staticmethod
multiIf(cond_1, then_1, cond_2, then_2, ..., else)
cond_N— The N-th evaluated condition which controls ifthen_Nis returned.UInt8orNullable(UInt8)orNULLthen_N— The result of the function whencond_Nis true. -else— The result of the function if none of the conditions is true. Returns the result ofthen_Nfor matchingcond_N, otherwise returns theelsecondition.
multiMatchAllIndices(haystack, pattern1=None, pattern2=None, patternn=None)
staticmethod
multiMatchAllIndices(haystack, [pattern1, pattern2, ..., patternn])
haystack— String in which the search is performed.Stringpattern— Regular expressions to match against.String
Array of all indices (starting from 1) that match the haystack in any order. Returns an empty array if no matches are found. Array(UInt64)
multiMatchAny(haystack, pattern1, pattern2=None)
staticmethod
multiMatchAny(haystack, pattern1[, pattern2, ...])
haystack— String in which patterns are searched.Stringpattern1[, pattern2, ...]— An array of one or more regular expression patterns.Array(String)
Returns 1 if any pattern matches, 0 otherwise. UInt8
multiMatchAnyIndex(haystack, pattern1=None, pattern2=None, patternn=None)
staticmethod
multiMatchAnyIndex(haystack, [pattern1, pattern2, ..., patternn])
haystack— String in which the search is performed.Stringpattern— Regular expressions to match against.Array(String)
Returns the index (starting from 1) of the first pattern that matches, or 0 if no match is found. UInt64
multiSearchAllPositions(haystack, needle1, needle2=None)
staticmethod
multiSearchAllPositions(haystack, needle1[, needle2, ...])
haystack— String in which the search is performed.Stringneedle1[, needle2, ...]— An array of one or more substrings to be searched.Array(String)
Returns array of the starting position in bytes and counting from 1, if the substring was found, 0, if the substring was not found. Array(UInt64)
multiSearchAllPositionsCaseInsensitive(haystack, needle1, needle2=None)
staticmethod
multiSearchAllPositionsCaseInsensitive(haystack, needle1[, needle2, ...])
haystack— String in which the search is performed.Stringneedle1[, needle2, ...]— An array of one or more substrings to be searched.Array(String)
Returns array of the starting position in bytes and counting from 1 (if the substring was found), 0 if the substring was not found. Array(UInt64)
multiSearchAllPositionsCaseInsensitiveUTF8(haystack, needle1=None, needle2=None, needleN=None)
staticmethod
multiSearchAllPositionsCaseInsensitiveUTF8(haystack, [needle1, needle2, ..., needleN])
haystack— UTF-8 encoded string in which the search is performed.Stringneedle— UTF-8 encoded substrings to be searched.Array(String)
Array of the starting position in bytes and counting from 1 (if the substring was found). Returns 0 if the substring was not found. Array
multiSearchAllPositionsUTF8(haystack, needle1, needle2=None)
staticmethod
multiSearchAllPositionsUTF8(haystack, needle1[, needle2, ...])
haystack— UTF-8 encoded string in which the search is performed.Stringneedle1[, needle2, ...]— An array of UTF-8 encoded substrings to be searched.Array(String)
Returns array of the starting position in bytes and counting from 1 (if the substring was found), 0 if the substring was not found. Array
multiSearchAny(haystack, needle1, needle2=None)
staticmethod
multiSearchAny(haystack, needle1[, needle2, ...])
haystack— String in which the search is performed.Stringneedle1[, needle2, ...]— An array of substrings to be searched.Array(String)
Returns 1, if there was at least one match, otherwise 0, if there was not at least one match. UInt8
multiSearchAnyCaseInsensitive(haystack, needle1=None, needle2=None, needleN=None)
staticmethod
multiSearchAnyCaseInsensitive(haystack, [needle1, needle2, ..., needleN])
haystack— String in which the search is performed.Stringneedle— Substrings to be searched.Array(String)
Returns 1, if there was at least one case-insensitive match, otherwise 0, if there was not at least one case-insensitive match. UInt8
multiSearchAnyCaseInsensitiveUTF8(haystack, needle1=None, needle2=None, needleN=None)
staticmethod
multiSearchAnyCaseInsensitiveUTF8(haystack, [needle1, needle2, ..., needleN])
haystack— UTF-8 string in which the search is performed.Stringneedle— UTF-8 substrings to be searched.Array(String)
Returns 1, if there was at least one case-insensitive match, otherwise 0, if there was not at least one case-insensitive match. UInt8
multiSearchAnyUTF8(haystack, needle1=None, needle2=None, needleN=None)
staticmethod
multiSearchAnyUTF8(haystack, [needle1, needle2, ..., needleN])
haystack— UTF-8 string in which the search is performed.Stringneedle— UTF-8 substrings to be searched.Array(String)
Returns 1, if there was at least one match, otherwise 0, if there was not at least one match. UInt8
multiSearchFirstIndex(haystack, needle1=None, needle2=None, needleN=None)
staticmethod
multiSearchFirstIndex(haystack, [needle1, needle2, ..., needleN])
haystack— The string to search in.Stringneedles— Array of strings to search for.Array(String)
Returns the 1-based index (position in the needles array) of the first needle found in the haystack. Returns 0 if no needles are found. The search is case-sensitive. UInt64
multiSearchFirstIndexCaseInsensitive()
staticmethod
multiSearchFirstIndexCaseInsensitive(haystack, [needle1, needle2, ..., needleN]
haystack— String in which the search is performed.Stringneedle— Substrings to be searched.Array(String)
Returns the index (starting from 1) of the leftmost found needle. Otherwise 0, if there was no match. UInt8
multiSearchFirstIndexCaseInsensitiveUTF8(haystack, needle1=None, needle2=None, needleN=None)
staticmethod
multiSearchFirstIndexCaseInsensitiveUTF8(haystack, [needle1, needle2, ..., needleN])
haystack— The string to search in.Stringneedles— Array of strings to search for.Array(String)
Returns the 1-based index (position in the needles array) of the first needle found in the haystack. Returns 0 if no needles are found. The search is case-insensitive and respects UTF-8 character encoding. UInt64
multiSearchFirstIndexUTF8(haystack, needle1=None, needle2=None, needleN=None)
staticmethod
multiSearchFirstIndexUTF8(haystack, [needle1, needle2, ..., needleN])
haystack— UTF-8 string in which the search is performed.Stringneedle— Array of UTF-8 substrings to be searched.Array(String)
Returns the index (starting from 1) of the leftmost found needle. Otherwise 0, if there was no match. UInt8
multiSearchFirstPosition(haystack, needle1, needle2=None)
staticmethod
multiSearchFirstPosition(haystack, needle1[, needle2, ...])
haystack— String in which the search is performed.Stringneedle1[, needle2, ...]— An array of one or more substrings to be searched.Array(String)
Returns the leftmost offset in a haystack string which matches any of multiple needle strings, otherwise 0, if there was no match. UInt64
multiSearchFirstPositionCaseInsensitive(haystack, needle1=None, needle2=None, needleN=None)
staticmethod
multiSearchFirstPositionCaseInsensitive(haystack, [needle1, needle2, ..., needleN])
haystack— String in which the search is performed.Stringneedle— Array of substrings to be searched.Array(String)
Returns the leftmost offset in a haystack string which matches any of multiple needle strings. Returns 0, if there was no match. UInt64
multiSearchFirstPositionCaseInsensitiveUTF8(haystack, needle1=None, needle2=None, needleN=None)
staticmethod
multiSearchFirstPositionCaseInsensitiveUTF8(haystack, [needle1, needle2, ..., needleN])
haystack— UTF-8 string in which the search is performed.Stringneedle— Array of UTF-8 substrings to be searched.Array(String)
Returns the leftmost offset in a haystack string which matches any of multiple needle strings, ignoring case. Returns 0, if there was no match. UInt64
multiSearchFirstPositionUTF8(haystack, needle1=None, needle2=None, needleN=None)
staticmethod
multiSearchFirstPositionUTF8(haystack, [needle1, needle2, ..., needleN])
haystack— UTF-8 string in which the search is performed.Stringneedle— Array of UTF-8 substrings to be searched.Array(String)
Leftmost offset in a haystack string which matches any of multiple needle strings. Returns 0, if there was no match. UInt64
multiply(x, y)
staticmethod
multiplyDecimal(a, b, result_scale=None)
staticmethod
multiplyDecimal(a, b[, result_scale])
The result of multiplication with the given scale. Type: Decimal256
murmurHash2_32(arg1, arg2=None)
staticmethod
murmurHash2_64(arg1, arg2=None)
staticmethod
murmurHash3_128(arg1, arg2=None)
staticmethod
murmurHash3_128(arg1[, arg2, ...])
arg1[, arg2, ...]— A variable number of input arguments for which to compute the hash.Any
Returns the computed 128-bit MurmurHash3 hash value of the input arguments. FixedString(16)
murmurHash3_32(arg1, arg2=None)
staticmethod
murmurHash3_64(arg1, arg2=None)
staticmethod
naiveBayesClassifier(model_name, input_text)
staticmethod
naiveBayesClassifier(model_name, input_text)
model_name— Name of the pre-configured model. The model must be defined in ClickHouse's configuration files.Stringinput_text— Text to classify. Input is processed exactly as provided (case/punctuation preserved).String
Predicted class ID as an unsigned integer. Class IDs correspond to categories defined during model construction. UInt32
naturalSortKey(s)
staticmethod
negate(x)
staticmethod
negate(x)
x— The value to negate. Returns -x from x
neighbor(column, offset, default_value=None)
staticmethod
neighbor(column, offset[, default_value])
column— The source column.Anyoffset— The offset from the current row. Positive values look forward, negative values look backward.Integerdefault_value— Optional. The value to return if the offset goes beyond the data bounds. If not specified, uses the default value for the column type.Any
Returns a value from the specified offset, or default if out of bounds. Any
nested(*args)
staticmethod
netloc(url)
staticmethod
ngramDistance(haystack, needle)
staticmethod
ngramDistanceCaseInsensitive(haystack, needle)
staticmethod
ngramDistanceCaseInsensitiveUTF8(haystack, needle)
staticmethod
ngramDistanceUTF8(haystack, needle)
staticmethod
ngramMinHash(string, ngramsize=None, hashnum=None)
staticmethod
ngramMinHash(string[, ngramsize, hashnum])
string— String for which to compute the hash.Stringngramsize— Optional. The size of an n-gram, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two hashes — the minimum and the maximum. Tuple
ngramMinHashArg(string, ngramsize=None, hashnum=None)
staticmethod
ngramMinHashArg(string[, ngramsize, hashnum])
string— String for which to compute the hash.Stringngramsize— Optional. The size of an n-gram, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two tuples with hashnum n-grams each. Tuple(String)
ngramMinHashArgCaseInsensitive(string, ngramsize=None, hashnum=None)
staticmethod
ngramMinHashArgCaseInsensitive(string[, ngramsize, hashnum])
string— String for which to compute the hash.Stringngramsize— Optional. The size of an n-gram, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two tuples with hashnum n-grams each. Tuple(Tuple(String))
ngramMinHashArgCaseInsensitiveUTF8(string, ngramsize=None, hashnum=None)
staticmethod
ngramMinHashArgCaseInsensitiveUTF8(string[, ngramsize, hashnum])
string— String for which to compute the hash.Stringngramsize— Optional. The size of an n-gram, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two tuples with hashnum n-grams each. Tuple(Tuple(String))
ngramMinHashArgUTF8(string, ngramsize=None, hashnum=None)
staticmethod
ngramMinHashArgUTF8(string[, ngramsize, hashnum])
string— String for which to compute the hash.Stringngramsize— Optional. The size of an n-gram, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two tuples with hashnum n-grams each. Tuple(Tuple(String))
ngramMinHashCaseInsensitive(string, ngramsize=None, hashnum=None)
staticmethod
ngramMinHashCaseInsensitive(string[, ngramsize, hashnum])
string— String. String. -ngramsize— The size of an n-gram. Optional. Possible values: any number from1to25. Default value:3. UInt8. -hashnum— The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from1to25. Default value:6. UInt8. Tuple with two hashes — the minimum and the maximum. Tuple(UInt64, UInt64).Tuple
ngramMinHashCaseInsensitiveUTF8(string, ngramsize=None, hashnum=None)
staticmethod
ngramMinHashCaseInsensitiveUTF8(string [, ngramsize, hashnum])
string— String for which to compute the hash.Stringngramsize— Optional. The size of an n-gram, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two hashes — the minimum and the maximum. Tuple
ngramMinHashUTF8(string, ngramsize=None, hashnum=None)
staticmethod
ngramMinHashUTF8(string[, ngramsize, hashnum])
string— String for which to compute the hash.Stringngramsize— Optional. The size of an n-gram, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two hashes — the minimum and the maximum. Tuple
ngramSearch(haystack, needle)
staticmethod
ngramSearchCaseInsensitive(haystack, needle)
staticmethod
ngramSearchCaseInsensitiveUTF8(haystack, needle)
staticmethod
ngramSearchUTF8(haystack, needle)
staticmethod
ngramSimHash(string, ngramsize=None)
staticmethod
ngramSimHashCaseInsensitive(string, ngramsize=None)
staticmethod
ngramSimHashCaseInsensitiveUTF8(string, ngramsize=None)
staticmethod
ngramSimHashUTF8(string, ngramsize=None)
staticmethod
ngrams(s, N)
staticmethod
ngrams(s, N)
s— Input string.StringorFixedStringN— The n-gram length.const UInt8/16/32/64
Returns an array with n-grams. Array(String)
nonNegativeDerivative(*args)
staticmethod
normalizeQuery(x)
staticmethod
normalizeQueryKeepNames(x)
staticmethod
normalizeUTF8NFC(str)
staticmethod
normalizeUTF8NFD(str)
staticmethod
normalizeUTF8NFKC(str)
staticmethod
normalizeUTF8NFKCCasefold(str)
staticmethod
normalizeUTF8NFKD(str)
staticmethod
normalizedQueryHash(x)
staticmethod
normalizedQueryHashKeepNames(x)
staticmethod
notEmpty(arr)
staticmethod
notEquals(a, b)
staticmethod
notILike(haystack, pattern)
staticmethod
notILike(haystack, pattern)
haystack— The input string to search in.StringorFixedStringpattern— The SQL LIKE pattern to match against.%matches any number of characters (including zero),_matches exactly one character.String
Returns 1 if the string does not match the pattern (case-insensitive), otherwise 0. UInt8
notIn(x, set)
staticmethod
notIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is not in the set, 0 otherwise.UInt8
notInIgnoreSet(x, set)
staticmethod
notIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is not in the set, 0 otherwise.UInt8
notLike(haystack, pattern)
staticmethod
notLike(haystack, pattern) -- haystack NOT LIKE pattern
haystack— String in which the search is performed.StringorFixedStringpattern— LIKE pattern to match against.String
Returns 1 if the string does not match the LIKE pattern, otherwise 0. UInt8
notNullIn(x, set)
staticmethod
notNullIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is not in the set, 0 otherwise.UInt8
notNullInIgnoreSet(x, set)
staticmethod
notNullIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is not in the set, 0 otherwise.UInt8
not_(val)
staticmethod
not(val)
Returns:
- 1, if val evaluates to false
- 0, if val evaluates to true
- NULL, if val is NULL.
Nullable(UInt8)
nothing(*args)
staticmethod
nothingNull(*args)
staticmethod
nothingUInt64(*args)
staticmethod
now(timezone=None)
staticmethod
now64(scale=None, timezone=None)
staticmethod
now64([scale[, timezone]])
scale— Optional. Tick size (precision): 10^-precision seconds. Valid range: [0 : 9]. Typically, are used - 3 (default) (milliseconds), 6 (microseconds), 9 (nanoseconds).UInt8timezone— Optional. Timezone name for the returned value.String
Returns current date and time with sub-second precision. DateTime64
nowInBlock(timezone=None)
staticmethod
nowInBlock64(scale=None, timezone=None)
staticmethod
nowInBlock64([scale[, timezone]])
scale— Optional. Tick size (precision): 10^-precision seconds. Valid range: [0 : 9]. Typically, are used - 3 (default) (milliseconds), 6 (microseconds), 9 (nanoseconds).UInt8timezone— Optional. Timezone name for the returned value.String
Returns the current date and time at the moment of processing of each block of data with sub-second precision. DateTime64
nth_value(*args)
staticmethod
ntile(*args)
staticmethod
nullIf(x, y)
staticmethod
nullIf(x, y)
Returns NULL if both arguments are equal, otherwise returns the first argument. NULL or Nullable(x)
nullIn(x, set)
staticmethod
nullIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is in the set, 0 otherwise.UInt8
nullInIgnoreSet(x, set)
staticmethod
nullIn(x, set)
x— The value to check. -set— The set of values. Returns 1 if x is in the set, 0 otherwise.UInt8
numericIndexedVectorAllValueSum(v)
staticmethod
numericIndexedVectorBuild(map)
staticmethod
numericIndexedVectorBuild(map)
map— A mapping from index to value.Map
Returns a NumericIndexedVector object. AggregateFunction
numericIndexedVectorCardinality(v)
staticmethod
numericIndexedVectorCardinality(v)
Returns the number of unique indexes. UInt64
numericIndexedVectorGetValue(v, i)
staticmethod
numericIndexedVectorGetValue(v, i)
v—numericIndexedVectori— The index for which the value is to be retrieved.(U)Int*
A numeric value with the same type as the value type of NumericIndexedVector. (U)Int* or Float*
numericIndexedVectorPointwiseAdd(v1, v2)
staticmethod
numericIndexedVectorPointwiseAdd(v1, v2)
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returns a new numericIndexedVector object. numericIndexedVector
numericIndexedVectorPointwiseDivide(v1, v2)
staticmethod
numericIndexedVectorPointwiseDivide(v1, v2)
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returns a new numericIndexedVector object. numericIndexedVector
numericIndexedVectorPointwiseEqual(v1, v2)
staticmethod
numericIndexedVectorPointwiseEqual(v1, v2)
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returns a new numericIndexedVector object. numericIndexedVector
numericIndexedVectorPointwiseGreater(v1, v2)
staticmethod
numericIndexedVectorPointwiseGreater(v1, v2)
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returns a new numericIndexedVector object. numericIndexedVector
numericIndexedVectorPointwiseGreaterEqual(v1, v2)
staticmethod
numericIndexedVectorPointwiseGreaterEqual(v1, v2)
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returns a new numericIndexedVector object. numericIndexedVector
numericIndexedVectorPointwiseLess(v1, v2)
staticmethod
numericIndexedVectorPointwiseLess(v1, v2)
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returns a new numericIndexedVector object. numericIndexedVector
numericIndexedVectorPointwiseLessEqual(v1, v2)
staticmethod
numericIndexedVectorPointwiseLessEqual(v1, v2)
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object(U)Int*orFloat*ornumericIndexedVector
Returns a new numericIndexedVector object. numericIndexedVector
numericIndexedVectorPointwiseMultiply(v1, v2)
staticmethod
numericIndexedVectorPointwiseMultiply(v1, v2)
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returns a new numericIndexedVector object. numericIndexedVector
numericIndexedVectorPointwiseNotEqual(v1, v2)
staticmethod
numericIndexedVectorPointwiseNotEqual(v1, v2)
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returns a new numericIndexedVector object. numericIndexedVector
numericIndexedVectorPointwiseSubtract(v1, v2)
staticmethod
numericIndexedVectorPointwiseSubtract(v1, v2)
v1—numericIndexedVectorv2— A numeric constant or numericIndexedVector object.(U)Int*orFloat*ornumericIndexedVector
Returns a new numericIndexedVector object. numericIndexedVector
numericIndexedVectorShortDebugString(v)
staticmethod
numericIndexedVectorShortDebugString(v)
Returns a JSON string containing debug information. String
numericIndexedVectorToMap(v)
staticmethod
or_(val1, val2)
staticmethod
or(val1, val2[, ...])
val1, val2[, ...]— List of at least two values.Nullable((U)Int*)orNullable(Float*)
Returns:
- 1, if at least one argument evaluates to true
- 0, if all arguments evaluate to false
- NULL, if all arguments evaluate to false and at least one argument is NULL
Nullable(UInt8)
overlay(s, replace, offset, length=None)
staticmethod
overlay(s, replace, offset[, length])
s— The input string.Stringreplace— The replacement stringconst Stringoffset— An integer typeInt(1-based). Ifoffsetis negative, it is counted from the end of the strings.Intlength— Optional. An integer typeInt.lengthspecifies the length of the snippet within the input stringsto be replaced. Iflengthis not specified, the number of bytes removed fromsequals the length ofreplace; otherwiselengthbytes are removed.Int
Returns a string with replacement. String
overlayUTF8(s, replace, offset, length=None)
staticmethod
overlayUTF8(s, replace, offset[, length])
s— The input string.Stringreplace— The replacement string.const Stringoffset— An integer typeInt(1-based). Ifoffsetis negative, it is counted from the end of the input strings.(U)Int*length— Optional. Specifies the length of the snippet within the input stringsto be replaced. Iflengthis not specified, the number of characters removed fromsequals the length ofreplace, otherwiselengthcharacters are removed.(U)Int*
Returns a string with replacement. String
parseDateTime(time_string, format, timezone=None)
staticmethod
parseDateTime(time_string, format[, timezone])
time_string— String to be parsed into DateTime.Stringformat— Format string specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns a DateTime parsed from the input string according to the MySQL style format string. DateTime
parseDateTime32BestEffort(time_string, time_zone=None)
staticmethod
parseDateTime32BestEffortOrNull(time_string, time_zone=None)
staticmethod
parseDateTime32BestEffortOrZero(time_string, time_zone=None)
staticmethod
parseDateTime32BestEffortOrZero(time_string[, time_zone])
time_string— String containing a date and time to convert.Stringtime_zone— Optional. Time zone according to whichtime_stringis parsed.String
Returns a DateTime object parsed from the string, or zero date (1970-01-01 00:00:00) if the parsing fails. DateTime
parseDateTime64(time_string, format, timezone=None)
staticmethod
parseDateTime64(time_string, format[, timezone])
time_string— String to be parsed into DateTime64.Stringformat— Format string specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns a DateTime64 parsed from the input string according to the MySQL style format string. DateTime64
parseDateTime64BestEffort(time_string, precision=None, time_zone=None)
staticmethod
parseDateTime64BestEffort(time_string[, precision[, time_zone]])
time_string— String containing a date or date with time to convert.Stringprecision— Optional. Required precision.3for milliseconds,6for microseconds. Default:3.UInt8time_zone— Optional. Timezone. The function parsestime_stringaccording to the timezone.String
Returns time_string converted to the DateTime64 data type. DateTime64
parseDateTime64BestEffortOrNull(time_string, precision=None, time_zone=None)
staticmethod
parseDateTime64BestEffortOrNull(time_string[, precision[, time_zone]])
time_string— String containing a date or date with time to convert.Stringprecision— Optional. Required precision.3for milliseconds,6for microseconds. Default:3.UInt8time_zone— Optional. Timezone. The function parsestime_stringaccording to the timezone.String
Returns time_string converted to DateTime64, or NULL if the input cannot be parsed. DateTime64 or NULL
parseDateTime64BestEffortOrZero(time_string, precision=None, time_zone=None)
staticmethod
parseDateTime64BestEffortOrZero(time_string[, precision[, time_zone]])
time_string— String containing a date or date with time to convert.Stringprecision— Optional. Required precision.3for milliseconds,6for microseconds. Default:3.UInt8time_zone— Optional. Timezone. The function parsestime_stringaccording to the timezone.String
Returns time_string converted to DateTime64, or zero date/datetime (1970-01-01 00:00:00.000) if the input cannot be parsed. DateTime64
parseDateTime64BestEffortUS(time_string, precision=None, time_zone=None)
staticmethod
parseDateTime64BestEffortUS(time_string [, precision [, time_zone]])
time_string— String containing a date or date with time to convert.Stringprecision— Optional. Required precision.3for milliseconds,6for microseconds. Default:3.UInt8time_zone— Optional. Timezone. The function parsestime_stringaccording to the timezone.String
Returns time_string converted to DateTime64 using US date format preference for ambiguous cases. DateTime64
parseDateTime64BestEffortUSOrNull(time_string, precision=None, time_zone=None)
staticmethod
parseDateTime64BestEffortUSOrNull(time_string[, precision[, time_zone]])
time_string— String containing a date or date with time to convert.Stringprecision— Optional. Required precision.3for milliseconds,6for microseconds. Default:3.UInt8time_zone— Optional. Timezone. The function parsestime_stringaccording to the timezone.String
Returns time_string converted to DateTime64 using US format preference, or NULL if the input cannot be parsed. DateTime64 or NULL
parseDateTime64BestEffortUSOrZero(time_string, precision=None, time_zone=None)
staticmethod
parseDateTime64BestEffortUSOrZero(time_string [, precision [, time_zone]])
time_string— String containing a date or date with time to convert.Stringprecision— Optional. Required precision.3for milliseconds,6for microseconds. Default:3.UInt8time_zone— Optional. Timezone. The function parsestime_stringaccording to the timezone.String
Returns time_string converted to DateTime64 using US format preference, or zero date/datetime (1970-01-01 00:00:00.000) if the input cannot be parsed. DateTime64
parseDateTime64InJodaSyntax(time_string, format, timezone=None)
staticmethod
parseDateTime64InJodaSyntax(time_string, format[, timezone])
time_string— String to be parsed into DateTime64.Stringformat— Format string in Joda syntax specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns a DateTime64 parsed from the input string according to the Joda style format string. DateTime64
parseDateTime64InJodaSyntaxOrNull(time_string, format, timezone=None)
staticmethod
parseDateTime64InJodaSyntaxOrNull(time_string, format[, timezone])
time_string— String to be parsed into DateTime64.Stringformat— Format string in Joda syntax specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns DateTime64 parsed from input string, or NULL if parsing fails. Nullable(DateTime64)
parseDateTime64InJodaSyntaxOrZero(time_string, format, timezone=None)
staticmethod
parseDateTime64InJodaSyntaxOrZero(time_string, format[, timezone])
time_string— String to be parsed into DateTime64.Stringformat— Format string in Joda syntax specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns DateTime64 parsed from input string, or zero DateTime64 if parsing fails. DateTime64
parseDateTime64OrNull(time_string, format, timezone=None)
staticmethod
parseDateTime64OrNull(time_string, format[, timezone])
time_string— String to be parsed into DateTime64.Stringformat— Format string specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns DateTime64 parsed from input string, or NULL if parsing fails. Nullable(DateTime64)
parseDateTime64OrZero(time_string, format, timezone=None)
staticmethod
parseDateTime64OrZero(time_string, format[, timezone])
time_string— String to be parsed into DateTime64.Stringformat— Format string specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns DateTime64 parsed from input string, or zero DateTime64 if parsing fails. DateTime64
parseDateTimeBestEffort(time_string, time_zone=None)
staticmethod
parseDateTimeBestEffortOrNull(time_string, time_zone=None)
staticmethod
parseDateTimeBestEffortOrZero(time_string, time_zone=None)
staticmethod
parseDateTimeBestEffortOrZero(time_string[, time_zone])
time_string— String containing a date and time to convert.Stringtime_zone— Optional. Time zone according to whichtime_stringis parsed.String
Returns time_string as a DateTime, or zero date/datetime (1970-01-01 or 1970-01-01 00:00:00) if the input cannot be parsed. DateTime
parseDateTimeBestEffortUS(time_string, time_zone=None)
staticmethod
parseDateTimeBestEffortUSOrNull(time_string, time_zone=None)
staticmethod
parseDateTimeBestEffortUSOrNull(time_string[, time_zone])
time_string— String containing a date and time to convert.Stringtime_zone— Optional. Time zone according to whichtime_stringis parsed.String
Returns time_string as a DateTime using US format preference, or NULL if the input cannot be parsed. DateTime or NULL
parseDateTimeBestEffortUSOrZero(time_string, time_zone=None)
staticmethod
parseDateTimeBestEffortUSOrZero(time_string[, time_zone])
time_string— String containing a date and time to convert.Stringtime_zone— Optional. Time zone according to whichtime_stringis parsed.String
Returns time_string as a DateTime using US format preference, or zero date/datetime (1970-01-01 or 1970-01-01 00:00:00) if the input cannot be parsed. DateTime
parseDateTimeInJodaSyntax(time_string, format, timezone=None)
staticmethod
parseDateTimeInJodaSyntax(time_string, format[, timezone])
time_string— String to be parsed into DateTime.Stringformat— Format string in Joda syntax specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns a DateTime parsed from the input string according to the Joda style format string. DateTime
parseDateTimeInJodaSyntaxOrNull(time_string, format, timezone=None)
staticmethod
parseDateTimeInJodaSyntaxOrNull(time_string, format[, timezone])
time_string— String to be parsed into DateTime.Stringformat— Format string in Joda syntax specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns DateTime parsed from input string, or NULL if parsing fails. Nullable(DateTime)
parseDateTimeInJodaSyntaxOrZero(time_string, format, timezone=None)
staticmethod
parseDateTimeInJodaSyntaxOrZero(time_string, format[, timezone])
time_string— String to be parsed into DateTime.Stringformat— Format string in Joda syntax specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns DateTime parsed from input string, or zero DateTime if parsing fails. DateTime
parseDateTimeOrNull(time_string, format, timezone=None)
staticmethod
parseDateTimeOrNull(time_string, format[, timezone])
time_string— String to be parsed into DateTime.Stringformat— Format string specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns DateTime parsed from input string, or NULL if parsing fails. Nullable(DateTime)
parseDateTimeOrZero(time_string, format, timezone=None)
staticmethod
parseDateTimeOrZero(time_string, format[, timezone])
time_string— String to be parsed into DateTime.Stringformat— Format string specifying how to parse time_string.Stringtimezone— Optional. Timezone.String
Returns DateTime parsed from input string, or zero DateTime if parsing fails. DateTime
parseReadableSize(x)
staticmethod
parseReadableSizeOrNull(x)
staticmethod
parseReadableSizeOrNull(x)
x— Readable size with ISO/IEC 80000-13 or decimal byte unit.String
Returns the number of bytes, rounded up to the nearest integer, or NULL if unable to parse the input Nullable(UInt64)
parseReadableSizeOrZero(x)
staticmethod
parseTimeDelta(timestr)
staticmethod
partitionId(column1, column2=None)
staticmethod
partitionId(column1[, column2, ...])
column1, column2, ...— Column for which to return the partition ID. Returns the partition ID that the row belongs to.String
path(url)
staticmethod
pathFull(url)
staticmethod
percentRank(*args)
staticmethod
perimeterCartesian(object)
staticmethod
perimeterSpherical(object)
staticmethod
pi()
staticmethod
pi()
Returns pi Float64
plus(x, y)
staticmethod
plus(x, y)
x— Left hand operand. -y— Right hand operand. Returns the sum of x and y
pointInPolygon(x, y)
staticmethod
pointInPolygon((x, y), [(a, b), (c, d) ...], ...)
(x, y)— Coordinates of a point on the plane.Tuple(Float64, Float64)[(a, b), (c, d) ...]— Polygon vertices as an array of coordinate pairs. Vertices should be in clockwise or counterclockwise order. Minimum 3 vertices required.Array(Tuple(Float64, Float64))...— Optional. Additional arguments for polygons with holes (as separate arrays) or multipolygons (as separate polygons).Array(Tuple(Float64, Float64))orPolygonorMultiPolygon
Returns 1 if the point is inside the polygon, 0 if it is not. If the point is on the polygon boundary, the function may return either 0 or 1. UInt8
polygonAreaCartesian(polygon)
staticmethod
polygonAreaSpherical(polygon)
staticmethod
polygonConvexHullCartesian(multipolygon)
staticmethod
polygonConvexHullCartesian(multipolygon)
multipolygon— A MultiPolygon value.MultiPolygon
Returns the convex hull as a Polygon. Polygon
polygonPerimeterCartesian(polygon)
staticmethod
polygonPerimeterSpherical(polygon)
staticmethod
polygonsDistanceCartesian(polygon1, polygon2)
staticmethod
polygonsDistanceSpherical(polygon1, polygon2)
staticmethod
polygonsEqualsCartesian(polygon1, polygon2)
staticmethod
polygonsIntersectCartesian(polygon1, polygon2)
staticmethod
polygonsIntersectCartesian(polygon1, polygon2)
polygon1— A value of typePolygonorMultiPolygon. -polygon2— A value of typePolygonorMultiPolygon. Returns true (1) if the two polygons intersect.Bool.
polygonsIntersectSpherical(polygon1, polygon2)
staticmethod
polygonsIntersectSpherical(polygon1, polygon2)
polygon1— A value of typePolygonorMultiPolygon. -polygon2— A value of typePolygonorMultiPolygon. Returns true (1) if the two polygons intersect (share any common area or boundary).Bool.
polygonsIntersectionCartesian(polygon1, polygon2)
staticmethod
polygonsIntersectionCartesian(polygon1, polygon2)
Returns the intersection of the polygons as a MultiPolygon. MultiPolygon
polygonsIntersectionSpherical(polygon1, polygon2)
staticmethod
polygonsIntersectionSpherical(polygon1, polygon2)
polygon1— First Polygon with spherical coordinates.Polygonpolygon2— Second Polygon with spherical coordinates.Polygon
Returns the intersection of the polygons as a MultiPolygon. MultiPolygon
polygonsSymDifferenceCartesian(polygon1, polygon2)
staticmethod
polygonsSymDifferenceCartesian(polygon1, polygon2)
Returns the symmetric difference of the polygons as a MultiPolygon. MultiPolygon
polygonsSymDifferenceSpherical(polygon1, polygon2)
staticmethod
polygonsSymDifferenceSpherical(polygon1, polygon2)
Returns the symmetric difference of the polygons as a MultiPolygon. MultiPolygon
polygonsUnionCartesian(polygon1, polygon2)
staticmethod
polygonsUnionCartesian(polygon1, polygon2)
Returns the union of the polygons as a MultiPolygon. MultiPolygon
polygonsUnionSpherical(polygon1, polygon2)
staticmethod
polygonsUnionSpherical(polygon1, polygon2)
Returns the union of the polygons as a MultiPolygon. MultiPolygon
polygonsWithinCartesian(polygon1, polygon2)
staticmethod
polygonsWithinSpherical(polygon1, polygon2)
staticmethod
port(url, default_port=None)
staticmethod
portRFC(url, default_port=None)
staticmethod
position(haystack, needle, start_pos=None)
staticmethod
position(haystack, needle[, start_pos])
haystack— String in which the search is performed.StringorEnumneedle— Substring to be searched.Stringstart_pos— Position (1-based) inhaystackat which the search starts. Optional.UInt
Returns starting position in bytes and counting from 1, if the substring was found, otherwise 0, if the substring was not found. UInt64
positionCaseInsensitive(haystack, needle, start_pos=None)
staticmethod
positionCaseInsensitive(haystack, needle[, start_pos])
haystack— String in which the search is performed.StringorEnumneedle— Substring to be searched.Stringstart_pos— Optional. Position (1-based) inhaystackat which the search starts.UInt*
Returns starting position in bytes and counting from 1, if the substring was found, otherwise 0, if the substring was not found. UInt64
positionCaseInsensitiveUTF8(haystack, needle, start_pos=None)
staticmethod
positionCaseInsensitiveUTF8(haystack, needle[, start_pos])
haystack— String in which the search is performed.StringorEnumneedle— Substring to be searched.Stringstart_pos— Optional. Position (1-based) inhaystackat which the search starts.UInt*
Returns starting position in bytes and counting from 1, if the substring was found, otherwise 0, if the substring was not found. UInt64
positionUTF8(haystack, needle, start_pos=None)
staticmethod
positionUTF8(haystack, needle[, start_pos])
haystack— String in which the search is performed.StringorEnumneedle— Substring to be searched.Stringstart_pos— Optional. Position (1-based) inhaystackat which the search starts.UInt*
Returns starting position in bytes and counting from 1, if the substring was found, otherwise 0, if the substring was not found. UInt64
positiveModulo(x, y)
staticmethod
positiveModuloOrNull(x, y)
staticmethod
positiveModuloOrNull(x, y)
x— The dividend.(U)Int*/Float32/64. -x— The divisor (modulus).(U)Int*/Float32/64. Returns the difference betweenxand the nearest integer not greater thanxdivisible byy,nullwhen the divisor is zero.
pow(x, y)
staticmethod
pow(x, y)
x— The base.(U)Int8/16/32/64orFloat*orDecimal*y— The exponent.(U)Int8/16/32/64orFloat*orDecimal*
Returns x^y Float64
printf(format, sub1=None, sub2=None)
staticmethod
proportionsZTest(successes_x, successes_y, trials_x, trials_y, conf_level, pool_type)
staticmethod
proportionsZTest(successes_x, successes_y, trials_x, trials_y, conf_level, pool_type)
successes_x— Number of successes in population x.UInt64successes_y— Number of successes in population y.UInt64trials_x— Number of trials in population x.UInt64trials_y— Number of trials in population y.UInt64conf_level— Confidence level for the test.Float64pool_type— Selection of pooling method for standard error estimation. Can be either 'unpooled' or 'pooled'.String
Returns a tuple containing: z_stat (Z statistic), p_val (P value), ci_low (lower confidence interval), ci_high (upper confidence interval). Tuple(Float64, Float64, Float64, Float64)
protocol(url)
staticmethod
punycodeDecode(s)
staticmethod
punycodeEncode(s)
staticmethod
quantile(level)
staticmethod
quantileBFloat16(level)
staticmethod
quantileBFloat16Weighted(level)
staticmethod
quantileDD(relative_accuracy, level=None)
staticmethod
quantileDeterministic(level)
staticmethod
quantileDeterministic(level)(expr, determinator)
expr— Expression over the column values resulting in numeric data types, Date or DateTime.(U)Int*orFloat*orDecimal*orDateorDateTimedeterminator— Number whose hash is used instead of a random number generator in the reservoir sampling algorithm to make the result of sampling deterministic. As a determinator you can use any deterministic positive number, for example, a user id or an event id. If the same determinator value occurs too often, the function works incorrectly.(U)Int*
Returns an approximate quantile of the specified level. Float64 or Date or DateTime
quantileExact(level)
staticmethod
quantileExact(level)(expr)
expr— Expression over the column values resulting in numeric data types, Date or DateTime.(U)Int*orFloat*orDecimal*orDateorDateTime
Quantile of the specified level. For numeric data types the output format will be the same as the input format. (U)Int* or Float* or Decimal* or Date or DateTime
quantileExactExclusive(level)
staticmethod
quantileExactHigh(level)
staticmethod
quantileExactInclusive(level)
staticmethod
quantileExactLow(level)
staticmethod
quantileExactWeighted(level)
staticmethod
quantileExactWeighted(level)(expr, weight)
expr— Expression over the column values resulting in numeric data types, Date or DateTime.(U)Int*orFloat*orDecimal*orDateorDateTimeweight— Column with weights of sequence members. Weight is a number of value occurrences.UInt*
Quantile of the specified level. Float64 or Date or DateTime
quantileExactWeightedInterpolated(level)
staticmethod
quantileExactWeightedInterpolated(level)(expr, weight)
expr— Expression over the column values resulting in numeric data types, Date or DateTime.(U)Int*orFloat*orDecimal*orDateorDateTimeweight— Column with weights of sequence members. Weight is a number of value occurrences.UInt*
Quantile of the specified level. Float64 or Date or DateTime
quantileGK(accuracy, level)
staticmethod
quantileInterpolatedWeighted(level)
staticmethod
quantileInterpolatedWeighted(level)(expr, weight)
expr— Expression over the column values resulting in numeric data types, Date or DateTime.(U)Int*orFloat*orDecimal*orDateorDateTimeweight— Column with weights of sequence members. Weight is a number of value occurrences.UInt*
Quantile of the specified level. Float64 or Date or DateTime
quantilePrometheusHistogram(level)
staticmethod
quantilePrometheusHistogram(level)(bucket_upper_bound, cumulative_bucket_value)
bucket_upper_bound— Upper bounds of the histogram buckets. The highest bucket must have an upper bound of+Inf.Float64cumulative_bucket_value— Cumulative values of the histogram buckets. Values must be monotonically increasing as the bucket upper bound increases.(U)Int*orFloat64
Returns the quantile of the specified level. Float64
quantileTDigest(level)
staticmethod
quantileTDigestWeighted(level)
staticmethod
quantileTDigestWeighted(level)(expr, weight)
expr— Expression over the column values resulting in numeric data types, Date or DateTime.(U)Int*orFloat*orDecimal*orDateorDateTimeweight— Column with weights of sequence elements. Weight is a number of value occurrences.UInt*
Approximate quantile of the specified level. Float64 or Date or DateTime
quantileTiming(level)
staticmethod
quantileTiming(level)(expr)
expr— Expression over a column values returning a Float*-type number. If negative values are passed to the function, the behavior is undefined. If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000.Float*
Quantile of the specified level. If no values are passed to the function (when using quantileTimingIf), NaN is returned. The purpose of this is to differentiate these cases from cases that result in zero. Float32
quantileTimingWeighted(level)
staticmethod
quantileTimingWeighted(level)(expr, weight)
expr— Expression over a column values returning a Float*-type number. If negative values are passed to the function, the behavior is undefined. If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000.Float*weight— Column with weights of sequence elements. Weight is a number of value occurrences.UInt*
Quantile of the specified level. Float32
quantiles(level1, level2)
staticmethod
quantiles(level1, level2, ...)(expr)
expr— Expression over the column values resulting in numeric data types, Date or DateTime.(U)Int*orFloat*orDecimal*orDateorDateTime
Array of approximate quantiles of the specified levels in the same order as the levels were specified. Array(Float64) or Array(Date) or Array(DateTime)
quantilesBFloat16(*args)
staticmethod
quantilesBFloat16Weighted(*args)
staticmethod
quantilesDD(*args)
staticmethod
quantilesDeterministic(*args)
staticmethod
quantilesExact(*args)
staticmethod
quantilesExactExclusive(level1, level2)
staticmethod
quantilesExactHigh(*args)
staticmethod
quantilesExactInclusive(level1, level2)
staticmethod
quantilesExactLow(*args)
staticmethod
quantilesExactWeighted(*args)
staticmethod
quantilesExactWeightedInterpolated(*args)
staticmethod
quantilesGK(accuracy, level1, level2)
staticmethod
quantilesGK(accuracy, level1, level2, ...)(expr)
expr— Expression over the column values resulting in numeric data types, Date or DateTime.(U)Int*orFloat*orDecimal*orDateorDateTime
Array of quantiles of the specified levels in the same order as the levels were specified. Array(Float64) or Array(Date) or Array(DateTime)
quantilesInterpolatedWeighted(*args)
staticmethod
quantilesPrometheusHistogram(level)
staticmethod
quantilePrometheusHistogram(level)(bucket_upper_bound, cumulative_bucket_value)
bucket_upper_bound— Upper bounds of the histogram buckets. The highest bucket must have an upper bound of+Inf.Float64cumulative_bucket_value— Cumulative values of the histogram buckets. Values must be monotonically increasing as the bucket upper bound increases.(U)Int*orFloat64
Returns the quantile of the specified level. Float64
quantilesTDigest(level1, level2)
staticmethod
quantilesTDigest(level1, level2, ...)(expr)
expr— Expression over the column values resulting in numeric data types, Date or DateTime.(U)Int*orFloat*orDecimal*orDateorDateTime
Array of approximate quantiles of the specified levels in the same order as the levels were specified. Array(Float64) or Array(Date) or Array(DateTime)
quantilesTDigestWeighted(level1, level2)
staticmethod
quantilesTDigestWeighted(level1, level2, ...)(expr, weight)
expr— Expression over the column values resulting in numeric data types, Date or DateTime.(U)Int*orFloat*orDecimal*orDateorDateTimeweight— Column with weights of sequence elements. Weight is a number of value occurrences.UInt*
Array of approximate quantiles of the specified levels in the same order as the levels were specified. Array(Float64) or Array(Date) or Array(DateTime)
quantilesTiming(level1, level2)
staticmethod
quantilesTiming(level1, level2, ...)(expr)
expr— Expression over a column values returning a Float*-type number. If negative values are passed to the function, the behavior is undefined. If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000.Float*
Array of quantiles of the specified levels in the same order as the levels were specified. Array(Float32)
quantilesTimingWeighted(level1, level2)
staticmethod
quantilesTimingWeighted(level1, level2, ...)(expr, weight)
expr— Expression over a column values returning a Float*-type number. If negative values are passed to the function, the behavior is undefined. If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000.Float*weight— Column with weights of sequence elements. Weight is a number of value occurrences.UInt*
Array of quantiles of the specified levels in the same order as the levels were specified. Array(Float32)
queryID()
staticmethod
queryID()
Returns the ID of the current query. String
queryString(url)
staticmethod
queryStringAndFragment(url)
staticmethod
radians(x)
staticmethod
rand(x=None)
staticmethod
rand([x])
x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random number of type UInt32. UInt32
rand64(x=None)
staticmethod
rand64([x])
x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random UInt64 number with uniform distribution. UInt64
randBernoulli(probability, x=None)
staticmethod
randBernoulli(probability[, x])
probability— The probability of success as a value between0and1.Float64x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random Float64 number drawn from the specified Bernoulli distribution. UInt64
randBinomial(experiments, probability, x=None)
staticmethod
randBinomial(experiments, probability[, x])
experiments— The number of experimentsUInt64probability— The probability of success in each experiment as a value between0and1Float64x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random Float64 number drawn from the specified binomial distribution. UInt64
randCanonical(x=None)
staticmethod
randCanonical([x])
x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random Float64 number. Float64
randChiSquared(degree_of_freedom, x=None)
staticmethod
randChiSquared(degree_of_freedom[, x])
degree_of_freedom— Degrees of freedom.Float64x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random Float64 number drawn from the specified chi-square distribution. Float64
randConstant(x=None)
staticmethod
randConstant([x])
x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a column of type UInt32 containing the same random value in each row. UInt32
randExponential(lambda_, x=None)
staticmethod
randExponential(lambda[, x])
lambda— Rate parameter or lambda value of the distributionFloat64x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random Float64 number drawn from the specified exponential distribution. Float64
randFisherF(d1, d2, x=None)
staticmethod
randFisherF(d1, d2[, x])
d1— d1 degree of freedom inX = (S1 / d1) / (S2 / d2).Float64d2— d2 degree of freedom inX = (S1 / d1) / (S2 / d2).Float64x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random Float64 number drawn from the specified F-distribution Float64
randLogNormal(mean, stddev, x=None)
staticmethod
randLogNormal(mean, stddev[, x])
mean— The mean value of distribution.Float64stddev— The standard deviation of the distribution.Float64x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random Float64 number drawn from the specified log-normal distribution. Float64
randNegativeBinomial(experiments, probability, x=None)
staticmethod
randNegativeBinomial(experiments, probability[, x])
experiments— The number of experiments.UInt64probability—The probability of failure in each experiment as a value between0and1. [Float64`](https://clickhouse.com/docs/sql-reference/data-types/float)x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random Float64 number drawn from the specified negative binomial distribution UInt64
randNormal(mean, stddev, x=None)
staticmethod
randNormal(mean, stddev[, x])
mean— The mean value of distributionFloat64stddev— The standard deviation of the distributionFloat64x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random Float64 number drawn from the specified normal distribution. Float64
randPoisson(n, x=None)
staticmethod
randPoisson(n[, x])
n— The mean number of occurrences.UInt64x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random Float64 number drawn from the specified Poisson distribution. UInt64
randStudentT(degree_of_freedom, x=None)
staticmethod
randStudentT(degree_of_freedom[, x])
degree_of_freedom— Degrees of freedom.Float64x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random Float64 number drawn from the specified Student's t-distribution. Float64
randUniform(min, max, x=None)
staticmethod
randUniform(min, max[, x])
min— Left boundary of the range (inclusive).Float64max— Right boundary of the range (inclusive).Float64x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a random number drawn uniformly from the interval formed by min and max. Float64
randomFixedString(length)
staticmethod
randomFixedString(length)
length— Length of the string in bytes.UInt*
Returns a string filled with random bytes. FixedString
randomPrintableASCII(length, x=None)
staticmethod
randomPrintableASCII(length[, x])
length— String length in bytes.(U)Int*x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a string with a random set of ASCII printable characters. String
randomString(length, x=None)
staticmethod
randomString(length[, x])
length— Length of the string in bytes.(U)Int*x— Optional and ignored. The only purpose of the argument is to prevent common subexpression elimination when the same function call is used multiple times in a query.Any
Returns a string filled with random bytes. String
randomStringUTF8(length)
staticmethod
range(start=None, end=None, step=None)
staticmethod
range([start, ] end [, step])
start— Optional. The first element of the array. Required ifstepis used. Default value:0. -end— Required. The number before which the array is constructed. -step— Optional. Determines the incremental step between each element in the array. Default value:1. Array of numbers fromstarttoend - 1bystep.Array(T)
rank(*args)
staticmethod
rankCorr(x, y)
staticmethod
readWKB(wkb_string)
staticmethod
readWKBLineString(wkb_string)
staticmethod
readWKBMultiLineString(wkb_string)
staticmethod
readWKBMultiPolygon(wkb_string)
staticmethod
readWKBPoint(wkb_string)
staticmethod
readWKBPolygon(wkb_string)
staticmethod
readWKT(wkt_string)
staticmethod
readWKT(wkt_string)
wkt_string— The input WKT string representing a LineString geometry.String
Returns a ClickHouse internal representation of the Geometry.
readWKTLineString(wkt_string)
staticmethod
readWKTMultiLineString(wkt_string)
staticmethod
readWKTMultiPolygon(wkt_string)
staticmethod
readWKTMultiPolygon(wkt_string)
wkt_string— String starting withMULTIPOLYGONString
Returns a MultiPolygon MultiPolygon
readWKTPoint(wkt_string)
staticmethod
readWKTPolygon(wkt_string)
staticmethod
readWKTRing(wkt_string)
staticmethod
regexpExtract(haystack, pattern, index=None)
staticmethod
regexpExtract(haystack, pattern[, index])
haystack— String, in which regexp pattern will be matched.Stringpattern— String, regexp expression.patternmay contain multiple regexp groups,indexindicates which regex group to extract. An index of 0 means matching the entire regular expression.const Stringindex— Optional. An integer number greater or equal 0 with default 1. It represents which regex group to extract.(U)Int*
Returns a string match String
regexpQuoteMeta(s)
staticmethod
regionHierarchy(id, geobase=None)
staticmethod
regionHierarchy(id[, geobase])
Array of region IDs consisting of the passed region and all parents along the chain Array(UInt32)
regionIn(lhs, rhs, geobase=None)
staticmethod
regionToArea(id, geobase=None)
staticmethod
regionToCity(id, geobase=None)
staticmethod
regionToContinent(id, geobase=None)
staticmethod
regionToCountry(id, geobase=None)
staticmethod
regionToDistrict(id, geobase=None)
staticmethod
regionToName(id, lang=None)
staticmethod
regionToPopulation(id, geobase=None)
staticmethod
regionToTopContinent(id, geobase=None)
staticmethod
reinterpret(x, type)
staticmethod
reinterpretAsDate(x)
staticmethod
reinterpretAsDateTime(x)
staticmethod
reinterpretAsFixedString(x)
staticmethod
reinterpretAsFixedString(x)
Fixed string containing bytes representing x. FixedString
reinterpretAsFloat32(x)
staticmethod
reinterpretAsFloat64(x)
staticmethod
reinterpretAsInt128(x)
staticmethod
reinterpretAsInt16(x)
staticmethod
reinterpretAsInt256(x)
staticmethod
reinterpretAsInt32(x)
staticmethod
reinterpretAsInt64(x)
staticmethod
reinterpretAsInt8(x)
staticmethod
reinterpretAsString(x)
staticmethod
reinterpretAsUInt128(x)
staticmethod
reinterpretAsUInt16(x)
staticmethod
reinterpretAsUInt256(x)
staticmethod
reinterpretAsUInt32(x)
staticmethod
reinterpretAsUInt64(x)
staticmethod
reinterpretAsUInt8(x)
staticmethod
reinterpretAsUUID(fixed_string)
staticmethod
reinterpretAsUUID(fixed_string)
fixed_string— Big-endian byte string.FixedString
The UUID type value. UUID
removeDiacriticsUTF8(str)
staticmethod
repeat(s, n)
staticmethod
replaceAll(haystack, pattern, replacement)
staticmethod
replaceAll(haystack, pattern, replacement)
haystack— The input string to search in.Stringpattern— The substring to find and replace.const Stringreplacement— The string to replace the pattern with.const String
Returns a string with all occurrences of pattern replaced. String
replaceOne(haystack, pattern, replacement)
staticmethod
replaceOne(haystack, pattern, replacement)
haystack— The input string to search in.Stringpattern— The substring to find and replace.const Stringreplacement— The string to replace the pattern with.const String
Returns a string with the first occurrence of pattern replaced. String
replaceRegexpAll(haystack, pattern, replacement)
staticmethod
replaceRegexpAll(haystack, pattern, replacement)
haystack— The input string to search in.Stringpattern— The regular expression pattern to find.const Stringreplacement— The string to replace the pattern with, may contain substitutions.const String
Returns a string with all regex matches replaced. String
replaceRegexpOne(haystack, pattern, replacement)
staticmethod
replaceRegexpOne(haystack, pattern, replacement)
haystack— The input string to search in.Stringpattern— The regular expression pattern to find.const Stringreplacement— The string to replace the pattern with, may contain substitutions.const String
Returns a string with the first regex match replaced. String
replicate(x, arr)
staticmethod
retention(*args)
staticmethod
reverse(arr, str)
staticmethod
reverseBySeparator(string, separator=None)
staticmethod
reverseBySeparator(string[, separator])
string— The input string to reverse the order of its parts.Stringseparator— The separator string used to identify parts. If not provided, uses '.' (dot). Default: '.'String
Returns a string with substrings ordered from right to left of the original string, joined by the same separator. String
reverseUTF8(s)
staticmethod
revision()
staticmethod
revision()
Returns the current ClickHouse server revision. UInt32
right(s, offset)
staticmethod
right(s, offset)
s— The string to calculate a substring from.StringorFixedStringoffset— The number of bytes of the offset.(U)Int*
Returns:
- For positive offset, a substring of s with offset many bytes, starting from the right of the string.
- For negative offset, a substring of s with length(s) - |offset| bytes, starting from the right of the string.
- An empty string if length is 0.
String
rightPad(string, length, pad_string=None)
staticmethod
rightPad(string, length[, pad_string])
string— Input string that should be padded.Stringlength— The length of the resulting string. If the value is smaller than the input string length, then the input string is shortened tolengthcharacters.(U)Int*pad_string— Optional. The string to pad the input string with. If not specified, then the input string is padded with spaces.String
Returns a right-padded string of the given length. String
rightPadUTF8(string, length, pad_string=None)
staticmethod
rightPadUTF8(string, length[, pad_string])
string— Input string that should be padded.Stringlength— The length of the resulting string. If the value is smaller than the input string length, then the input string is shortened tolengthcharacters.(U)Int*pad_string— Optional. The string to pad the input string with. If not specified, then the input string is padded with spaces.String
Returns a right-padded string of the given length. String
rightUTF8(s, offset)
staticmethod
rightUTF8(s, offset)
s— The UTF-8 encoded string to calculate a substring from.StringorFixedStringoffset— The number of bytes of the offset.(U)Int*
Returns:
- For positive offset, a substring of s with offset many bytes, starting from the right of the string.
- For negative offset, a substring of s with length(s) - |offset| bytes, starting from the right of the string.
- An empty string if length is 0.
String
round(x, N=None)
staticmethod
roundAge(num)
staticmethod
roundBankers(x, N=None)
staticmethod
roundDown(num, arr)
staticmethod
roundDown(num, arr)
num— A number to round down.(U)Int*orDecimal*orFloat*arr— Array of elements to roundnumdown to.Array((U)Int*)orArray(Float*)
Returns a number rounded down to an element in arr. If the value is less than the lowest bound, the lowest bound is returned. (U)Int* or Float*
roundDuration(num)
staticmethod
roundToExp2(num)
staticmethod
rowNumberInAllBlocks()
staticmethod
rowNumberInAllBlocks()
Returns the ordinal number of the row in the data block starting from 0. UInt64
rowNumberInBlock()
staticmethod
rowNumberInBlock()
Returns the ordinal number of the row in the data block starting from 0. UInt64
row_number(*args)
staticmethod
runningAccumulate(agg_state, grouping=None)
staticmethod
runningAccumulate(agg_state[, grouping])
agg_state— State of the aggregate function.AggregateFunctiongrouping— Optional. Grouping key. The state of the function is reset if thegroupingvalue is changed. It can be any of the supported data types for which the equality operator is defined.Any
Returns the accumulated result for each row. Any
runningConcurrency(start, end)
staticmethod
runningConcurrency(start, end)
start— A column with the start time of events.DateorDateTimeorDateTime64end— A column with the end time of events.DateorDateTimeorDateTime64
Returns the number of concurrent events at each event start time. UInt32
runningDifference(x)
staticmethod
runningDifference(x)
x— Column for which to calculate the running difference.Any
Returns the difference between consecutive values, with 0 for the first row.
runningDifferenceStartingWithFirstValue(x)
staticmethod
s2CapContains(center, degrees, point)
staticmethod
s2CapUnion(center1, radius1, center2, radius2)
staticmethod
s2CapUnion(center1, radius1, center2, radius2)
center1— S2 cell identifier of the first cap center.UInt64radius1— Radius of the first cap in degrees.Float64center2— S2 cell identifier of the second cap center.UInt64radius2— Radius of the second cap in degrees.Float64
Returns a tuple (center, radius) representing the smallest cap containing both input caps. Tuple(UInt64, Float64)
s2CellsIntersect(s2index1, s2index2)
staticmethod
s2GetNeighbors(s2index)
staticmethod
s2GetNeighbors(s2index)
s2index— The S2 cell identifier.UInt64
Returns an array of 4 neighbor S2 cell identifiers. Array(UInt64)
s2RectAdd(s2RectLow, s2RectHigh, s2Point)
staticmethod
s2RectAdd(s2RectLow, s2RectHigh, s2Point)
s2RectLow— S2 cell identifier of the low vertex of the rectangle.UInt64s2RectHigh— S2 cell identifier of the high vertex of the rectangle.UInt64s2Point— S2 cell identifier of the point to add.UInt64
Returns a tuple (s2RectLow, s2RectHigh) representing the expanded rectangle. Tuple(UInt64, UInt64)
s2RectContains(s2RectLow, s2RectHigh, s2Point)
staticmethod
s2RectContains(s2RectLow, s2RectHigh, s2Point)
s2RectLow— S2 cell identifier of the low vertex of the rectangle.UInt64s2RectHigh— S2 cell identifier of the high vertex of the rectangle.UInt64s2Point— S2 cell identifier of the point to test.UInt64
Returns 1 if the rectangle contains the point and 0 otherwise. UInt8
s2RectIntersection(s2Rect1Low, s2Rect1High, s2Rect2Low, s2Rect2High)
staticmethod
s2RectIntersection(s2Rect1Low, s2Rect1High, s2Rect2Low, s2Rect2High)
s2Rect1Low— S2 cell identifier of the low vertex of the first rectangle.UInt64s2Rect1High— S2 cell identifier of the high vertex of the first rectangle.UInt64s2Rect2Low— S2 cell identifier of the low vertex of the second rectangle.UInt64s2Rect2High— S2 cell identifier of the high vertex of the second rectangle.UInt64
Returns a tuple (s2RectLow, s2RectHigh) representing the intersection rectangle. Tuple(UInt64, UInt64)
s2RectUnion(s2Rect1Low, s2Rect1High, s2Rect2Low, s2Rect2High)
staticmethod
s2RectUnion(s2Rect1Low, s2Rect1High, s2Rect2Low, s2Rect2High)
s2Rect1Low— S2 cell identifier of the low vertex of the first rectangle.UInt64s2Rect1High— S2 cell identifier of the high vertex of the first rectangle.UInt64s2Rect2Low— S2 cell identifier of the low vertex of the second rectangle.UInt64s2Rect2High— S2 cell identifier of the high vertex of the second rectangle.UInt64
Returns a tuple (s2RectLow, s2RectHigh) representing the union rectangle. Tuple(UInt64, UInt64)
s2ToGeo(s2index)
staticmethod
s2ToGeo(s2index)
s2index— The S2 cell identifier.UInt64
Returns a tuple (lon, lat) of Float64 values representing the longitude and latitude. Tuple(Float64, Float64)
sequenceCount(*args)
staticmethod
sequenceMatch(*args)
staticmethod
sequenceMatchEvents(*args)
staticmethod
sequenceNextNode(*args)
staticmethod
seriesDecomposeSTL(series, period)
staticmethod
seriesDecomposeSTL(series, period)
series— An array of numeric valuesArray((U)Int8/16/32/64)orArray(Float*)period— A positive integerUInt8/16/32/64
Returns an array of four arrays where the first array includes seasonal components, the second array - trend, the third array - residue component, and the fourth array - baseline(seasonal + trend) component. Array(Array(Float32), Array(Float32), Array(Float32), Array(Float32))
seriesOutliersDetectTukey(series, min_percentile=None, max_percentile=None, K=None)
staticmethod
seriesOutliersDetectTukey(series[, min_percentile, max_percentile, K])
series— An array of numeric values.Array((UInt8/16/32/64))orArray(Float*)min_percentile— Optional. The minimum percentile to be used to calculate inter-quantile range (IQR). The value must be in range [0.02,0.98]. The default is 0.25.Float*max_percentile— Optional. The maximum percentile to be used to calculate inter-quantile range (IQR). The value must be in range [0.02,0.98]. The default is 0.75.Float*K— Optional. Non-negative constant value to detect mild or stronger outliers. The default value is 1.5.Float*
Returns an array of the same length as the input array where each value represents score of possible anomaly of corresponding element in the series. A non-zero score indicates a possible anomaly. Array(Float32)
seriesPeriodDetectFFT(series)
staticmethod
seriesPeriodDetectFFT(series)
series— An array of numeric values.Array((U)Int8/16/32/64)orArray(Float*)
Returns a real value equal to the period of series data. NaN when number of data points are less than four. Float64
serverTimezone()
staticmethod
serverTimezone()
Returns the server timezone as a String
serverUUID()
staticmethod
serverUUID()
Returns the random UUID of the server. UUID
shardCount()
staticmethod
shardCount()
Returns the total number of shards or 0. UInt32
shardNum()
staticmethod
shardNum()
Returns the shard index or a constant 0. UInt32
showCertificate()
staticmethod
showCertificate()
Returns map of key-value pairs relating to the configured SSL certificate. Map(String, String)
sigmoid(x)
staticmethod
sign(x)
staticmethod
simpleJSONExtractBool(json, field_name)
staticmethod
simpleJSONExtractBool(json, field_name)
json— The JSON in which the field is searched for.Stringfield_name— The name of the field to search for.const String
Returns 1 if the value of the field is true, 0 otherwise. This means this function will return 0 including (and not only) in the following cases:
- If the field doesn't exists.
- If the field contains true as a string, e.g.: {"field":"true"}.
- If the field contains 1 as a numerical value. UInt8
simpleJSONExtractFloat(json, field_name)
staticmethod
simpleJSONExtractFloat(json, field_name)
json— The JSON in which the field is searched for.Stringfield_name— The name of the field to search for.const String
Returns the number parsed from the field if the field exists and contains a number, otherwise 0. Float64
simpleJSONExtractInt(json, field_name)
staticmethod
simpleJSONExtractInt(json, field_name)
json— The JSON in which the field is searched for.Stringfield_name— The name of the field to search for.const String
Returns the number parsed from the field if the field exists and contains a number, 0 otherwise Int64
simpleJSONExtractRaw(json, field_name)
staticmethod
simpleJSONExtractRaw(json, field_name)
json— The JSON in which the field is searched for.Stringfield_name— The name of the field to search for.const String
Returns the value of the field as a string, including separators if the field exists, or an empty string otherwise String
simpleJSONExtractString(json, field_name)
staticmethod
simpleJSONExtractString(json, field_name)
json— The JSON in which the field is searched for.Stringfield_name— The name of the field to search for.const String
Returns the unescaped value of a field as a string, including separators. An empty string is returned if the field doesn't contain a double quoted string, if unescaping fails or if the field doesn't exist String
simpleJSONExtractUInt(json, field_name)
staticmethod
simpleJSONExtractUInt(json, field_name)
json— The JSON in which the field is searched for.Stringfield_name— The name of the field to search for.const String
Returns the number parsed from the field if the field exists and contains a number, 0 otherwise UInt64
simpleJSONHas(json, field_name)
staticmethod
simpleJSONHas(json, field_name)
json— The JSON in which the field is searched for.Stringfield_name— The name of the field to search for.const String
Returns 1 if the field exists, 0 otherwise UInt8
simpleLinearRegression(x, y)
staticmethod
simpleLinearRegression(x, y)
x— Column with explanatory variable values.Float64y— Column with dependent variable values.Float64
Returns constants (k, b) of the resulting line y = k*x + b. Tuple(Float64, Float64)
sin(x)
staticmethod
singleValueOrNull(x)
staticmethod
sinh(x)
staticmethod
sipHash128(arg1, arg2=None)
staticmethod
sipHash128(arg1[, arg2, ...])
arg1[, arg2, ...]— A variable number of input arguments for which to compute the hash.Any
Returns a 128-bit SipHash hash value. FixedString(16)
sipHash128Keyed(k0, k1)
staticmethod
sipHash128Keyed((k0, k1), [arg1, arg2, ...])
(k0, k1)— A tuple of two UInt64 values representing the key.Tuple(UInt64, UInt64)arg1[, arg2, ...]— A variable number of input arguments for which to compute the hash.Any
A 128-bit SipHash hash value of type FixedString(16). FixedString(16)
sipHash128Reference(arg1, arg2=None)
staticmethod
sipHash128Reference(arg1[, arg2, ...])
arg1[, arg2, ...]— A variable number of input arguments for which to compute the hash.Any
Returns the computed 128-bit SipHash hash value of the input arguments. FixedString(16)
sipHash128ReferenceKeyed(k0, k1)
staticmethod
sipHash128ReferenceKeyed((k0, k1), arg1[, arg2, ...])
(k0, k1)— Tuple of two values representing the keyTuple(UInt64, UInt64)arg1[, arg2, ...]— A variable number of input arguments for which to compute the hash.Any
Returns the computed 128-bit SipHash hash value of the input arguments. FixedString(16)
sipHash64(arg1, arg2=None)
staticmethod
sipHash64Keyed(k0, k1)
staticmethod
sipHash64Keyed((k0, k1), arg1[,arg2, ...])
(k0, k1)— A tuple of two values representing the key.Tuple(UInt64, UInt64)arg1[,arg2, ...]— A variable number of input arguments.Any
Returns the computed hash of the input values. UInt64
skewPop(expr)
staticmethod
skewPop(expr)
expr— An expression returning a number.Expression
Returns the skewness of the given distribution. Float64
skewSamp(expr)
staticmethod
skewSamp(expr)
expr— An expression returning a number.Expression
Returns the skewness of the given distribution. If n <= 1 (n is the size of the sample), then the function returns nan. Float64
sleep(seconds)
staticmethod
sleep(seconds)
seconds— The number of seconds to pause the query execution to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.const UInt*orconst Float*
Returns 0. UInt8
sleepEachRow(seconds)
staticmethod
sleepEachRow(seconds)
seconds— The number of seconds to pause the query execution for each row in the result set to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.const UInt*orconst Float*
Returns 0 for each row. UInt8
snowflakeIDToDateTime(value, epoch=None, time_zone=None)
staticmethod
snowflakeIDToDateTime(value[, epoch[, time_zone]])
value— Snowflake ID.UInt64epoch— Optional. Epoch of the Snowflake ID in milliseconds since 1970-01-01. Defaults to 0 (1970-01-01). For the Twitter/X epoch (2015-01-01), provide 1288834974657.UInt*time_zone— Optional. Timezone. The function parsestime_stringaccording to the timezone.String
Returns the timestamp component of value. DateTime
snowflakeIDToDateTime64(value, epoch=None, time_zone=None)
staticmethod
snowflakeIDToDateTime64(value[, epoch[, time_zone]])
value— Snowflake ID.UInt64epoch— Optional. Epoch of the Snowflake ID in milliseconds since 1970-01-01. Defaults to 0 (1970-01-01). For the Twitter/X epoch (2015-01-01), provide 1288834974657.UInt*time_zone— Optional. Timezone. The function parsestime_stringaccording to the timezone.String
Returns the timestamp component of value as a DateTime64 with scale = 3, i.e. millisecond precision. DateTime64
snowflakeToDateTime(value, time_zone=None)
staticmethod
snowflakeToDateTime64(value, time_zone=None)
staticmethod
snowflakeToDateTime64(value[, time_zone])
value— Snowflake ID.Int64time_zone— Optional. Timezone. The function parsestime_stringaccording to the timezone.String
Returns the timestamp component of value. DateTime64(3)
soundex(s)
staticmethod
space(n)
staticmethod
sparkbar(buckets, min_x=None, max_x=None)
staticmethod
sparkbar(buckets[, min_x, max_x])(x, y)
x— The field with values.const Stringy— The field with the frequency of values.const String
Returns the frequency histogram. String
sparseGrams(s, min_ngram_length=None, max_ngram_length=None)
staticmethod
sparseGrams(s[, min_ngram_length, max_ngram_length])
s— An input string.Stringmin_ngram_length— Optional. The minimum length of extracted ngram. The default and minimal value is 3.UInt*max_ngram_length— Optional. The maximum length of extracted ngram. The default value is 100. Should be not less thanmin_ngram_length.UInt*min_cutoff_length— Optional. If specified, only n-grams with length greater or equal thanmin_cutoff_lengthare returned. The default value is the same asmin_ngram_length. Should be not less thanmin_ngram_lengthand not greater thanmax_ngram_length.UInt*
Returns an array of selected substrings. Array(String)
sparseGramsHashes(s, min_ngram_length=None, max_ngram_length=None)
staticmethod
sparseGramsHashes(s[, min_ngram_length, max_ngram_length])
s— An input string.Stringmin_ngram_length— Optional. The minimum length of extracted ngram. The default and minimal value is 3.UInt*max_ngram_length— Optional. The maximum length of extracted ngram. The default value is 100. Should be not less thanmin_ngram_length.UInt*min_cutoff_length— Optional. If specified, only n-grams with length greater or equal thanmin_cutoff_lengthare returned. The default value is the same asmin_ngram_length. Should be not less thanmin_ngram_lengthand not greater thanmax_ngram_length.UInt*
Returns an array of selected substrings CRC32 hashes. Array(UInt32)
sparseGramsHashesUTF8(s, min_ngram_length=None, max_ngram_length=None)
staticmethod
sparseGramsHashesUTF8(s[, min_ngram_length, max_ngram_length])
s— An input string.Stringmin_ngram_length— Optional. The minimum length of extracted ngram. The default and minimal value is 3.UInt*max_ngram_length— Optional. The maximum length of extracted ngram. The default value is 100. Should be not less thanmin_ngram_length.UInt*min_cutoff_length— Optional. If specified, only n-grams with length greater or equal thanmin_cutoff_lengthare returned. The default value is the same asmin_ngram_length. Should be not less thanmin_ngram_lengthand not greater thanmax_ngram_length.UInt*
Returns an array of selected UTF-8 substrings CRC32 hashes. Array(UInt32)
sparseGramsUTF8(s, min_ngram_length=None, max_ngram_length=None)
staticmethod
sparseGramsUTF8(s[, min_ngram_length, max_ngram_length])
s— An input string.Stringmin_ngram_length— Optional. The minimum length of extracted ngram. The default and minimal value is 3.UInt*max_ngram_length— Optional. The maximum length of extracted ngram. The default value is 100. Should be not less thanmin_ngram_length.UInt*min_cutoff_length— Optional. If specified, only n-grams with length greater or equal thanmin_cutoff_lengthare returned. The default value is the same asmin_ngram_length. Should be not less thanmin_ngram_lengthand not greater thanmax_ngram_length.UInt*
Returns an array of selected UTF-8 substrings. Array(String)
splitByChar(separator, s, max_substrings=None)
staticmethod
splitByChar(separator, s[, max_substrings])
separator— The separator must be a single-byte character.Strings— The string to split.Stringmax_substrings— Optional. Ifmax_substrings > 0, the returned array will contain at mostmax_substringssubstrings, otherwise the function will return as many substrings as possible. The default value is0.Int64
Returns an array of selected substrings. Array(String)
splitByNonAlpha(s, max_substrings=None)
staticmethod
splitByNonAlpha(s[, max_substrings])
s— The string to split.Stringmax_substrings— Optional. Whenmax_substrings > 0, the returned substrings will be no more thanmax_substrings, otherwise the function will return as many substrings as possible. Default value:0.Int64
Returns an array of selected substrings of s. Array(String)
splitByRegexp(regexp, s, max_substrings=None)
staticmethod
splitByRegexp(regexp, s[, max_substrings])
regexp— Regular expression. Constant.StringorFixedStrings— The string to split.Stringmax_substrings— Optional. Whenmax_substrings > 0, the returned substrings will be no more thanmax_substrings, otherwise the function will return as many substrings as possible. Default value:0.Int64
Returns an array of the selected substrings of s. Array(String)
splitByString(separator, s, max_substrings=None)
staticmethod
splitByString(separator, s[, max_substrings])
separator— The separator.Strings— The string to split.Stringmax_substrings— Optional. Whenmax_substrings > 0, the returned substrings will be no more thanmax_substrings, otherwise the function will return as many substrings as possible. Default value:0.Int64
Returns an array of selected substrings of s Array(String)
splitByWhitespace(s, max_substrings=None)
staticmethod
splitByWhitespace(s[, max_substrings])
s— The string to split.Stringmax_substrings— Optional. Whenmax_substrings > 0, the returned substrings will be no more thanmax_substrings, otherwise the function will return as many substrings as possible. Default value:0.Int64
Returns an array of the selected substrings of s. Array(String)
sqidDecode(sqid)
staticmethod
sqidDecode(sqid)
sqid— The sqid to decode.String
Returns an array of numbers from sqid. Array(UInt64)
sqidEncode(n1, n2=None)
staticmethod
sqidEncode(n1[, n2, ...])
n1[, n2, ...]— Arbitrarily many numbers.UInt8/16/32/64
Returns a hash ID String
sqrt(x)
staticmethod
startsWith(s, prefix)
staticmethod
startsWithCaseInsensitive(s, prefix)
staticmethod
startsWithCaseInsensitiveUTF8(s, prefix)
staticmethod
startsWithUTF8(s, prefix)
staticmethod
stddevPop(x)
staticmethod
stddevPopStable(x)
staticmethod
stddevSamp(x)
staticmethod
stddevSampStable(x)
staticmethod
stem(lang, word)
staticmethod
stochasticLinearRegression(learning_rate=None, l2_regularization_coef=None, mini_batch_size=None, method=None)
staticmethod
stochasticLinearRegression([learning_rate, l2_regularization_coef, mini_batch_size, method])(target, x1, x2, ...)
learning_rate— The coefficient on step length when gradient descent step is performed. A learning rate that is too big may cause infinite weights of the model. Default is0.00001.Float64l2_regularization_coef— L2 regularization coefficient which may help to prevent overfitting. Default is0.1.Float64mini_batch_size— Sets the number of elements which gradients will be computed and summed to perform one step of gradient descent. Pure stochastic descent uses one element, however having small batches (about 10 elements) makes gradient steps more stable. Default is15.UInt64method— Method for updating weights:Adam(by default),SGD,Momentum,Nesterov.MomentumandNesterovrequire slightly more computations and memory, however they happen to be useful in terms of speed of convergence and stability of stochastic gradient methods.const Stringtarget— Target value (dependent variable) to learn to predict. Must be numeric.Float*x1, x2, ...— Feature values (independent variables). All must be numeric.Float*
Returns the trained linear regression model weights. First values correspond to the parameters of the model, the last one is bias. Use evalMLMethod for predictions. Array(Float64)
stochasticLogisticRegression(learning_rate=None, l2_regularization_coef=None, mini_batch_size=None, method=None)
staticmethod
stochasticLogisticRegression([learning_rate, l2_regularization_coef, mini_batch_size, method])(target, x1, x2, ...)
learning_rate— The coefficient on step length when gradient descent step is performed. A learning rate that is too big may cause infinite weights of the model. Default is0.00001.Float64l2_regularization_coef— L2 regularization coefficient which may help to prevent overfitting. Default is0.1.Float64mini_batch_size— Sets the number of elements which gradients will be computed and summed to perform one step of gradient descent. Pure stochastic descent uses one element, however having small batches (about 10 elements) makes gradient steps more stable. Default is15.UInt64method— Method for updating weights:Adam(by default),SGD,Momentum,Nesterov.MomentumandNesterovrequire a little bit more computations and memory, however they happen to be useful in terms of speed of convergence and stability of stochastic gradient methods.Stringtarget— Target binary classification labels. Must be in range [-1, 1].Floatx1, x2, ...— Feature values (independent variables). All must be numeric.Float
Returns the trained logistic regression model weights. Use evalMLMethod for predictions which returns probabilities of object having label 1. Array(Float64)
stringBytesEntropy(s)
staticmethod
stringBytesUniq(s)
staticmethod
stringJaccardIndex(s1, s2)
staticmethod
stringJaccardIndexUTF8(s1, s2)
staticmethod
stringToH3(index_str)
staticmethod
structureToCapnProtoSchema(table_structure, message)
staticmethod
structureToCapnProtoSchema(table_structure, message)
structureToProtobufSchema(structure, message_name)
staticmethod
structureToProtobufSchema(structure, message_name)
structure— ClickHouse table structure definition as a string (e.g., 'column1 Type1, column2 Type2').Stringmessage_name— Name for the Protobuf message type in the generated schema.String
Returns a Protobuf schema definition in proto3 syntax that corresponds to the input ClickHouse structure. String
studentTTest(confidence_level=None)
staticmethod
studentTTest([confidence_level])(sample_data, sample_index)
Returns a tuple with two or four elements (if the optional confidence_level is specified): calculated t-statistic, calculated p-value, [calculated confidence-interval-low], [calculated confidence-interval-high]. Tuple(Float64, Float64) or Tuple(Float64, Float64, Float64, Float64)
studentTTestOneSample(confidence_level=None)
staticmethod
studentTTestOneSample([confidence_level])(sample_data, population_mean)
sample_data— Sample data.IntegerorFloatorDecimalpopulation_mean— Known population mean to test against (usually a constant).(U)Int*orFloat*orDecimal
Returns a tuple with two or four elements (if confidence_level is specified): calculated t-statistic, calculated p-value (two-tailed), [calculated confidence-interval-low], [calculated confidence-interval-high]. Confidence intervals are for the sample mean at the given confidence level. Tuple(Float64, Float64) or Tuple(Float64, Float64, Float64, Float64)
subBitmap(bitmap, offset, cardinality_limit)
staticmethod
subBitmap(bitmap, offset, cardinality_limit)
bitmap— Bitmap object.AggregateFunction(groupBitmap, T). -offset— Number of set bits to skip from the beginning (zero-based).UInt32-cardinality_limit— Maximum number of set bits to include in the subset.UInt32Returns a bitmap containing at mostlimitset bits, starting after skippingoffsetset bits in ascending orderAggregateFunction(groupBitmap, T)
subDate(datetime, interval)
staticmethod
subDate(datetime, interval)
datetime— The date or date with time from whichintervalis subtracted.DateorDate32orDateTimeorDateTime64interval— Interval to subtract.Interval
Returns date or date with time obtained by subtracting interval from datetime. Date or Date32 or DateTime or DateTime64
substring(s, offset, length=None)
staticmethod
substring(s, offset[, length])
s— The string to calculate a substring from.StringorFixedStringorEnumoffset— The starting position of the substring ins.(U)Int*length— Optional. The maximum length of the substring.(U)Int*
Returns a substring of s with length many bytes, starting at index offset. String
substringIndex(s, delim, count)
staticmethod
substringIndex(s, delim, count)
s— The string to extract substring from.Stringdelim— The character to split.Stringcount— The number of occurrences of the delimiter to count before extracting the substring. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned.UIntorInt
Returns a substring of s before count occurrences of delim. String
substringIndexUTF8(s, delim, count)
staticmethod
substringIndexUTF8(s, delim, count)
s— The string to extract substring from.Stringdelim— The character to split.Stringcount— The number of occurrences of the delimiter to count before extracting the substring. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned.UIntorInt
Returns a substring of s before count occurrences of delim. String
substringUTF8(s, offset, length=None)
staticmethod
substringUTF8(s, offset[, length])
s— The string to calculate a substring from.StringorFixedStringorEnumoffset— The starting position of the substring ins.IntorUIntlength— The maximum length of the substring. Optional.IntorUInt
Returns a substring of s with length many code points, starting at code point index offset. String
subtractDays(datetime, num)
staticmethod
subtractHours(datetime, num)
staticmethod
subtractHours(datetime, num)
datetime— Date or date with time to subtract specified number of hours from.DateorDate32orDateTimeorDateTime64orStringnum— Number of hours to subtract.(U)Int*orFloat*
Returns datetime minus num hours DateTime or DateTime64(3)
subtractInterval(interval_1, interval_2)
staticmethod
subtractInterval(interval_1, interval_2)
interval_1— First interval or interval of tuples.IntervalorTuple(Interval)interval_2— Second interval to be negated.Interval
Returns a tuple of intervals Tuple(T)
subtractMicroseconds(datetime, num)
staticmethod
subtractMicroseconds(datetime, num)
datetime— Date with time to subtract specified number of microseconds from.DateTimeorDateTime64orStringnum— Number of microseconds to subtract.(U)Int*orFloat*
Returns datetime minus num microseconds DateTime64
subtractMilliseconds(datetime, num)
staticmethod
subtractMilliseconds(datetime, num)
datetime— Date with time to subtract specified number of milliseconds from.DateTimeorDateTime64orStringnum— Number of milliseconds to subtract.(U)Int*orFloat*
Returns datetime minus num milliseconds DateTime64
subtractMinutes(datetime, num)
staticmethod
subtractMinutes(datetime, num)
datetime— Date or date with time to subtract specified number of minutes from.DateorDate32orDateTimeorDateTime64orStringnum— Number of minutes to subtract.(U)Int*orFloat*
Returns datetime minus num minutes DateTime or DateTime64(3)
subtractMonths(datetime, num)
staticmethod
subtractNanoseconds(datetime, num)
staticmethod
subtractNanoseconds(datetime, num)
datetime— Date with time to subtract specified number of nanoseconds from.DateTimeorDateTime64orStringnum— Number of nanoseconds to subtract.(U)Int*orFloat*
Returns datetime minus num nanoseconds DateTime64
subtractQuarters(datetime, num)
staticmethod
subtractSeconds(datetime, num)
staticmethod
subtractSeconds(datetime, num)
datetime— Date or date with time to subtract specified number of seconds from.DateorDate32orDateTimeorDateTime64orStringnum— Number of seconds to subtract.(U)Int*orFloat*
Returns datetime minus num seconds DateTime or DateTime64(3)
subtractTupleOfIntervals(datetime, intervals)
staticmethod
subtractTupleOfIntervals(datetime, intervals)
datetime— Date or date with time to subtract intervals from.DateorDate32orDateTimeorDateTime64intervals— Tuple of intervals to subtract fromdatetime.Tuple(Interval)
Returns date with subtracted intervals Date or Date32 or DateTime or DateTime64
subtractWeeks(datetime, num)
staticmethod
subtractYears(datetime, num)
staticmethod
sum(num)
staticmethod
sumCount(x)
staticmethod
sumKahan(x)
staticmethod
sumMapFiltered(*args)
staticmethod
sumMapFilteredWithOverflow(*args)
staticmethod
sumMapWithOverflow(key, value)
staticmethod
sumMapWithOverflow(key, value) sumMapWithOverflow(Tuple(key, value))
Returns a tuple of two arrays: keys in sorted order, and values summed for the corresponding keys. Tuple(Array, Array)
sumMappedArrays(key, value1, value2=None)
staticmethod
sumMappedArrays(key, value1 [, value2, ...]) sumMappedArrays(Tuple(key, value1 [, value2, ...]))
Returns a tuple of arrays: the first array contains keys in sorted order, followed by arrays containing values summed for the corresponding keys. Tuple
sumWithOverflow(num)
staticmethod
svg(geometry, style=None)
staticmethod
synonyms(ext_name, word)
staticmethod
synonyms(ext_name, word)
ext_name— Name of the extension in which search will be performed.Stringword— Word that will be searched in extension.String
Returns array of synonyms for the given word. Array(String)
tan(x)
staticmethod
tanh(x)
staticmethod
tcpPort()
staticmethod
tcpPort()
Returns the TCP port number. UInt16
tgamma(x)
staticmethod
theilsU(column1, column2)
staticmethod
throwIf(x, message=None, error_code=None)
staticmethod
throwIf(x[, message[, error_code]])
x— The condition to check.Anymessage— Optional. Custom error message.const Stringerror_code— Optional. Custom error code.const Int8/16/32
Returns 0 if the condition is false, throws an exception if the condition is true. UInt8
tid()
staticmethod
tid()
Returns the current thread id. UInt64
timeDiff(startdate, enddate)
staticmethod
timeDiff(startdate, enddate)
startdate— The first time value to subtract (the subtrahend).DateorDate32orDateTimeorDateTime64enddate— The second time value to subtract from (the minuend).DateorDate32orDateTimeorDateTime64
Returns the difference between enddate and startdate expressed in seconds. Int64
timeSeriesChangesToGrid(start_timestamp, end_timestamp, grid_step, staleness)
staticmethod
timeSeriesChangesToGrid(start_timestamp, end_timestamp, grid_step, staleness)(timestamp, value)
timestamp— Timestamp of the sample. Can be individual values or arrays. -value— Value of the time series corresponding to the timestamp. Can be individual values or arrays.changesvalues on the specified grid as anArray(Nullable(Float64)). The returned array contains one value for each time grid point. The value is NULL if there are no samples within the window to calculate the changes value for a particular grid point.
timeSeriesCopyTag(dest_group, src_group, tag_to_copy)
staticmethod
timeSeriesCopyTag(dest_group, src_group, tag_to_copy)
dest_group— The destination group of tags.UInt64src_group— The source group of tags.UInt64tag_to_copy— The name of a tag to copy.String
Returns a group of tags containing the tags from dest_group along with the copied tags from src_group. UInt64
timeSeriesCopyTags(dest_group, src_group, tags_to_copy)
staticmethod
timeSeriesCopyTags(dest_group, src_group, tags_to_copy)
dest_group— The destination group of tags.UInt64src_group— The source group of tags.UInt64tags_to_copy— The names of tags to copy.Array(String)
Returns a group of tags containing the tags from dest_group along with the copied tags from src_group. UInt64
timeSeriesDeltaToGrid(start_timestamp, end_timestamp, grid_step, staleness)
staticmethod
timeSeriesDeltaToGrid(start_timestamp, end_timestamp, grid_step, staleness)(timestamp, value)
timestamp— Timestamp of the sample. Can be individual values or arrays.UInt32orDateTimeorArray(UInt32)orArray(DateTime)value— Value of the time series corresponding to the timestamp. Can be individual values or arrays.Float*orArray(Float*)
Returns delta values on the specified grid. The returned array contains one value for each time grid point. The value is NULL if there are not enough samples within the window to calculate the delta value for a particular grid point. Array(Nullable(Float64))
timeSeriesDerivToGrid(start_timestamp, end_timestamp, grid_step, staleness)
staticmethod
timeSeriesDerivToGrid(start_timestamp, end_timestamp, grid_step, staleness)(timestamp, value)
timestamp— Timestamp of the sample. Can be individual values or arrays. -value— Value of the time series corresponding to the timestamp. Can be individual values or arrays.derivvalues on the specified grid as anArray(Nullable(Float64)). The returned array contains one value for each time grid point. The value is NULL if there are not enough samples within the window to calculate the derivative value for a particular grid point.
timeSeriesExtractTag(group)
staticmethod
timeSeriesExtractTag(group)
Returns the value of a specified tag. Nullable(String)
timeSeriesFromGrid(start_timestamp, end_timestamp, step, values)
staticmethod
timeSeriesFromGrid(start_timestamp, end_timestamp, step, values)
start_timestamp— Start of the grid.DateTime64orDateTimeorUInt32end_timestamp— End of the grid.DateTime64orDateTimeorUInt32step— Step of the grid in secondsDecimal64orDecimal32orUInt32/64values— Array of valuesArray(Float*)orArray(Nullable(Float*))
Returns values from the source array of values combined with timestamps on a regular time grid described by start_timestamp and step. Array(Tuple(DateTime64, Float64))
timeSeriesGroupArray(timestamp, value)
staticmethod
timeSeriesGroupArray(timestamp, value)
timestamp— Timestamp of the sample.DateTimeorUInt32orUInt64value— Value of the time series corresponding to the timestamp.(U)Int*orFloat*orDecimal
Returns an array of tuples (timestamp, value) sorted by timestamp in ascending order. If there are multiple values for the same timestamp then the function chooses the greatest of these values. Array(Tuple(T1, T2))
timeSeriesGroupToTags(group)
staticmethod
timeSeriesGroupToTags(group)
group— A group of tags.UInt64
Returns an array of pairs (tag_name, tag_value).
The returned array is always sorted by tag_name and never contains the same tag_name more than once.
Array(Tuple(String, String))
timeSeriesIdToGroup(id)
staticmethod
timeSeriesIdToGroup(id)
id— Identifier of a time series.UInt64orUInt128orUUIDorFixedString(16)
Returns a group of tags associated with the identifier id of a time series. UInt64
timeSeriesIdToTags(id)
staticmethod
timeSeriesIdToTags(id)
id— Identifier of a time series.UInt64orUInt128orUUIDorFixedString(16)
Returns an array of pairs (tag_name, tag_value).
The returned array is always sorted by tag_name and never contains the same tag_name more than once.
Array(Tuple(String, String))
timeSeriesInstantDeltaToGrid(start_timestamp, end_timestamp, grid_step, staleness)
staticmethod
timeSeriesInstantDeltaToGrid(start_timestamp, end_timestamp, grid_step, staleness)(timestamp, value)
timestamp— Timestamp of the sample. Can be individual values or arrays.UInt32orDateTimeorArray(UInt32)orArray(DateTime)value— Value of the time series corresponding to the timestamp. Can be individual values or arrays.Float*orArray(Float*)
Returns idelta values on the specified grid. The returned array contains one value for each time grid point. The value is NULL if there are not enough samples within the window to calculate the instant delta value for a particular grid point. Array(Nullable(Float64))
timeSeriesInstantRateToGrid(start_timestamp, end_timestamp, grid_step, staleness)
staticmethod
timeSeriesInstantRateToGrid(start_timestamp, end_timestamp, grid_step, staleness)(timestamp, value)
timestamp— Timestamp of the sample. Can be individual values or arrays.UInt32orDateTimeorArray(UInt32)orArray(DateTime)value— Value of the time series corresponding to the timestamp. Can be individual values or arrays.Float*orArray(Float*)
Returns irate values on the specified grid. The returned array contains one value for each time grid point. The value is NULL if there are not enough samples within the window to calculate the instant rate value for a particular grid point. Array(Nullable(Float64))
timeSeriesJoinTags(group, dest_tag, separator, src_tags)
staticmethod
timeSeriesJoinTags(group, dest_tag, separator, src_tags)
group— A group of tags.UInt64dest_tag— The name of a tag with the joined result which will be added to thegroup.Stringseparator— A separator to insert between joined values.Stringsrc_tags— The names of source tags with values which will be joined.Array(String)
Returns a new group of tags with the dest_tag tag set to the joined result. UInt64
timeSeriesLastTwoSamples(timestamp, value)
staticmethod
timeSeriesLastTwoSamples(timestamp, value)
timestamp— Timestamp of the sample.DateTimeorDateTime64or(U)Int*orInt*value— Value of the time series corresponding to the timestamp.Float32orFloat64
Returns a pair of arrays of equal length from 0 to 2. The first array contains the timestamps of sampled time series, the second array contains the corresponding values of the time series. Tuple(Array(DateTime), Array(Float64))
timeSeriesPredictLinearToGrid(start_timestamp, end_timestamp, grid_step, staleness, predict_offset)
staticmethod
timeSeriesPredictLinearToGrid(start_timestamp, end_timestamp, grid_step, staleness, predict_offset)(timestamp, value)
timestamp— Timestamp of the sample. Can be individual values or arrays. -value— Value of the time series corresponding to the timestamp. Can be individual values or arrays.predict_linearvalues on the specified grid as anArray(Nullable(Float64)). The returned array contains one value for each time grid point. The value is NULL if there are not enough samples within the window to calculate the rate value for a particular grid point.
timeSeriesRange(start_timestamp, end_timestamp, step)
staticmethod
timeSeriesRange(start_timestamp, end_timestamp, step)
start_timestamp— Start of the range.DateTime64orDateTimeorUInt32end_timestamp— End of the range.DateTime64orDateTimeorUInt32step— Step of the range in secondsUInt32/64orDecimal32/64
Returns a range of timestamps. Array(DateTime64)
timeSeriesRateToGrid(start_timestamp, end_timestamp, grid_step, staleness)
staticmethod
timeSeriesRateToGrid(start_timestamp, end_timestamp, grid_step, staleness)(timestamp, value)
timestamp— Timestamp of the sample. Can be individual values or arrays.UInt32orDateTimeorArray(UInt32)orArray(DateTime)value— Value of the time series corresponding to the timestamp. Can be individual values or arrays.Float*orArray(Float*)
Returns rate values on the specified grid. The returned array contains one value for each time grid point. The value is NULL if there are not enough samples within the window to calculate the rate value for a particular grid point. Array(Nullable(Float64))
timeSeriesRemoveAllTagsExcept(group, tags_to_keep)
staticmethod
timeSeriesRemoveAllTagsExcept(group, tags_to_keep)
group— A group of tags.UInt64tags_to_keep— The names of tags to keep in the group.Array(String)
A new group of tags with only the specified tags kept. UInt64
timeSeriesRemoveTag(group, tag_to_remove)
staticmethod
timeSeriesRemoveTags(group, tags_to_remove)
staticmethod
timeSeriesRemoveTags(group, tags_to_remove)
group— A group of tags.UInt64tags_to_remove— The names of tags to remove from the group.Array(String)
A new group of tags without the specified tags. UInt64
timeSeriesReplaceTag(group, dest_tag, replacement, src_tag, regex)
staticmethod
timeSeriesReplaceTag(group, dest_tag, replacement, src_tag, regex)
group— A group of tags.UInt64dest_tag— The name of a destination tag to get the result group.Stringreplacement— A replacement pattern, can contain $1, $2 or $name to refer capturing groups in the regular expression 'regex'.Stringsrc_tag— The name of a tag which value is used to match the regular expression 'regex'.Stringregex— A regular expression.String
A new group of tags with maybe dest_tag added. UInt64
timeSeriesResampleToGridWithStaleness(start_timestamp, end_timestamp, grid_step, staleness_window)
staticmethod
timeSeriesResampleToGridWithStaleness(start_timestamp, end_timestamp, grid_step, staleness_window)(timestamp, value)
timestamp— Timestamp of the sample. Can be individual values or arrays.UInt32orDateTimeorArray(UInt32)orArray(DateTime)value— Value of the time series corresponding to the timestamp. Can be individual values or arrays.Float*orArray(Float*)
Returns time series values re-sampled to the specified grid. The returned array contains one value for each time grid point. The value is NULL if there is no sample for a particular grid point. Array(Nullable(Float64))
timeSeriesResetsToGrid(start_timestamp, end_timestamp, grid_step, staleness)
staticmethod
timeSeriesResetsToGrid(start_timestamp, end_timestamp, grid_step, staleness)(timestamp, value)
timestamp— Timestamp of the sample. Can be individual values or arrays. -value— Value of the time series corresponding to the timestamp. Can be individual values or arrays.resetsvalues on the specified grid as anArray(Nullable(Float64)). The returned array contains one value for each time grid point. The value is NULL if there are no samples within the window to calculate the resets value for a particular grid point.
timeSeriesStoreTags(id, tags_array, separate_tag_name_1, separate_tag_value_1)
staticmethod
timeSeriesStoreTags(id, tags_array, separate_tag_name_1, separate_tag_value_1, ...)
id— Identifier of a time series.UInt64orUInt128orUUIDorFixedString(16)tags_array— Array of pairs (tag_name, tag_value).Array(Tuple(String, String))orNULLseparate_tag_name_i— The name of a tag.StringorFixedStringseparate_tag_value_i— The value of a tag.StringorFixedStringorNullable(String)
Returns the identifier of a time series (i.e. just the first argument).
timeSeriesTagsToGroup(tags_array, tag_name_1, tag_value_1, tag_name2, tag_value2)
staticmethod
timeSeriesTagsToGroup(tags_array, tag_name_1, tag_value_1, tag_name2, tag_value2, ...)
tags_array— Array of pairs (tag_name, tag_value).Array(Tuple(String, String))orNULLtag_name_i— The name of a tag.StringorFixedStringtag_value_i— The value of a tag.StringorFixedStringorNullable(String)
Returns a group of tags associated with the specified tags. UInt64
timeSeriesThrowDuplicateSeriesIf(condition, group)
staticmethod
timeSlot(time, time_zone=None)
staticmethod
timeSlot(time[, time_zone])
time— Time to round to the start of a half-an-hour length interval.DateTimeorDate32orDateTime64time_zone— Optional. A String type const value or an expression representing the time zone.String
Returns the time rounded to the start of a half-an-hour length interval. DateTime
timeSlots(StartTime, Duration, Size=None)
staticmethod
timeSlots(StartTime, Duration[, Size])
StartTime— Starting time for the interval.DateTimeorDateTime64Duration— Duration of the interval in seconds.UInt32orDateTime64Size— Optional. Size of time slots in seconds. Default is 1800 (30 minutes).UInt32orDateTime64
Returns an array of DateTime/DateTime64 (return type matches the type of StartTime). For DateTime64, the return value's scale can differ from the scale of StartTime - the highest scale among all given arguments is taken. Array(DateTime) or Array(DateTime64)
timestamp(expr, expr_time=None)
staticmethod
timestamp(expr[, expr_time])
expr— Date or date with time.Stringexpr_time— Optional. Time to add to the converted value.String
Returns the converted value of expr, or expr with added time DateTime64(6)
timezone()
staticmethod
timezone()
Returns the canonical time zone name as a String
timezoneOf(datetime)
staticmethod
timezoneOf(datetime)
datetime— A value of type.DateTimeorDateTime64timezone— Optional. Timezone name to convert thedatetimevalue's timezone to.String
Returns the timezone name for datetime String
timezoneOffset(datetime)
staticmethod
timezoneOffset(datetime)
datetime—DateTimevalue to get the timezone offset for.DateTimeorDateTime64
Returns the offset from UTC in seconds Int32
toBFloat16(expr)
staticmethod
toBFloat16(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 16-bit brain-float value. BFloat16
toBFloat16OrNull(x)
staticmethod
toBFloat16OrZero(x)
staticmethod
toBool(expr)
staticmethod
toBool(expr)
expr— Expression returning a number or a string. For strings, accepts 'true' or 'false' (case-insensitive).(U)Int*orFloat*orStringorExpression
Returns true or false based on evaluation of the argument. Bool
toColumnTypeName(value)
staticmethod
toDate(x)
staticmethod
toDate32(expr)
staticmethod
toDate32OrDefault(expr, default=None)
staticmethod
toDate32OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.Date32
Value of type Date32 if successful, otherwise returns the default value if passed or 1900-01-01 if not. Date32
toDate32OrNull(x)
staticmethod
toDate32OrZero(x)
staticmethod
toDateOrDefault(expr, default=None)
staticmethod
toDateOrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.Date
Value of type Date if successful, otherwise returns the default value if passed or 1970-01-01 if not. Date
toDateOrNull(x)
staticmethod
toDateOrZero(x)
staticmethod
toDateTime(expr, time_zone=None)
staticmethod
toDateTime32(x, timezone=None)
staticmethod
toDateTime32(x[, timezone])
x— Input value to convert.StringorFixedStringorUInt*orFloat*orDateorDateTimeorDateTime64timezone— Optional. Timezone for the returnedDateTimevalue.String
Returns the converted input value. DateTime
toDateTime64(expr, scale, timezone=None)
staticmethod
toDateTime64(expr, scale[, timezone])
expr— Expression returning a number or a string representation of a number.Expressionscale— Tick size (precision): 10^(-scale) seconds.UInt8timezone— Optional. Time zone for the specifiedDateTime64object.String
Returns a calendar date and time of day, with sub-second precision. DateTime64
toDateTime64OrDefault(expr, scale, timezone=None, default=None)
staticmethod
toDateTime64OrDefault(expr, scale[, timezone, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*scale— Tick size (precision): 10^-precision seconds.UInt8timezone— Optional. Time zone.Stringdefault— Optional. The default value to return if parsing is unsuccessful.DateTime64
Value of type DateTime64 if successful, otherwise returns the default value if passed or 1970-01-01 00:00:00.000 if not. DateTime64
toDateTime64OrNull(x)
staticmethod
toDateTime64OrNull(x)
x— A string representation of a date with time and subsecond precision.String
Returns a DateTime64 value if successful, otherwise NULL. DateTime64 or NULL
toDateTime64OrZero(x)
staticmethod
toDateTime64OrZero(x)
x— A string representation of a date with time and subsecond precision.String
Returns a DateTime64 value if successful, otherwise the lower boundary of DateTime64 (1970-01-01 00:00:00.000). DateTime64
toDateTimeOrDefault(expr, timezone=None, default=None)
staticmethod
toDateTimeOrDefault(expr[, timezone, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*timezone— Optional. Time zone.Stringdefault— Optional. The default value to return if parsing is unsuccessful.DateTime
Value of type DateTime if successful, otherwise returns the default value if passed or 1970-01-01 00:00:00 if not. DateTime
toDateTimeOrNull(x)
staticmethod
toDateTimeOrZero(x)
staticmethod
toDayOfMonth(datetime)
staticmethod
toDayOfMonth(datetime)
datetime— Date or date with time to get the day of month from.DateorDate32orDateTimeorDateTime64
Returns the day of the month of the given date/time UInt8
toDayOfWeek(datetime, mode=None, timezone=None)
staticmethod
toDayOfWeek(datetime[, mode[, timezone]])
datetime— Date or date with time to get the day of week from.DateorDate32orDateTimeorDateTime64mode— Optional. Integer specifying the week mode (0-3). Defaults to 0 if omitted.UInt8timezone— Optional. Timezone to use for the conversion.String
Returns the day of the week for the given Date or DateTime UInt8
toDayOfYear(datetime)
staticmethod
toDayOfYear(datetime)
datetime— Date or date with time to get the day of year from.DateorDate32orDateTimeorDateTime64
Returns the day of the year of the given Date or DateTime UInt16
toDaysInMonth(datetime)
staticmethod
toDaysInMonth(datetime)
datetime— Date or date with time to get the number of days in the month from.DateorDate32orDateTimeorDateTime64
Returns the number of days in the month of the given date/time. UInt8
toDaysSinceYearZero(date, time_zone=None)
staticmethod
toDecimal128(expr, S)
staticmethod
toDecimal128(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have.UInt8
Returns a value of type Decimal(38, S) Decimal128(S)
toDecimal128OrDefault(expr, S, default=None)
staticmethod
toDecimal128OrDefault(expr, S[, default])
expr— A String representation of a number.StringS— Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have.UInt8default— Optional. The default value to return if parsing to type Decimal128(S) is unsuccessful.Decimal128(S)
Value of type Decimal(38, S) if successful, otherwise returns the default value if passed or 0 if not. Decimal128(S)
toDecimal128OrNull(expr, S)
staticmethod
toDecimal128OrNull(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have.UInt8
Returns a Decimal(38, S) value if successful, otherwise NULL. Decimal128(S) or NULL
toDecimal128OrZero(expr, S)
staticmethod
toDecimal128OrZero(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have.UInt8
Returns a Decimal(38, S) value if successful, otherwise 0. Decimal128(S)
toDecimal256(expr, S)
staticmethod
toDecimal256(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have.UInt8
Returns a value of type Decimal(76, S). Decimal256(S)
toDecimal256OrDefault(expr, S, default=None)
staticmethod
toDecimal256OrDefault(expr, S[, default])
expr— A String representation of a number.StringS— Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have.UInt8default— Optional. The default value to return if parsing to type Decimal256(S) is unsuccessful.Decimal256(S)
Value of type Decimal(76, S) if successful, otherwise returns the default value if passed or 0 if not. Decimal256(S)
toDecimal256OrNull(expr, S)
staticmethod
toDecimal256OrNull(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have.UInt8
Returns a Decimal(76, S) value if successful, otherwise NULL. Decimal256(S) or NULL
toDecimal256OrZero(expr, S)
staticmethod
toDecimal256OrZero(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have.UInt8
Returns a Decimal(76, S) value if successful, otherwise 0. Decimal256(S)
toDecimal32(expr, S)
staticmethod
toDecimal32(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have.UInt8
Returns a value of type Decimal(9, S) Decimal32(S)
toDecimal32OrDefault(expr, S, default=None)
staticmethod
toDecimal32OrDefault(expr, S[, default])
expr— A String representation of a number.StringS— Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have.UInt8default— Optional. The default value to return if parsing to type Decimal32(S) is unsuccessful.Decimal32(S)
Value of type Decimal(9, S) if successful, otherwise returns the default value if passed or 0 if not. Decimal32(S)
toDecimal32OrNull(expr, S)
staticmethod
toDecimal32OrNull(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have.UInt8
Returns a Decimal(9, S) value if successful, otherwise NULL. Decimal32(S) or NULL
toDecimal32OrZero(expr, S)
staticmethod
toDecimal32OrZero(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have.UInt8
Returns a Decimal(9, S) value if successful, otherwise 0. Decimal32(S)
toDecimal64(expr, S)
staticmethod
toDecimal64(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have.UInt8
Returns a decimal value. Decimal(18, S)
toDecimal64OrDefault(expr, S, default=None)
staticmethod
toDecimal64OrDefault(expr, S[, default])
expr— A String representation of a number.StringS— Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have.UInt8default— Optional. The default value to return if parsing to type Decimal64(S) is unsuccessful.Decimal64(S)
Value of type Decimal(18, S) if successful, otherwise returns the default value if passed or 0 if not. Decimal64(S)
toDecimal64OrNull(expr, S)
staticmethod
toDecimal64OrNull(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have.UInt8
Returns a Decimal(18, S) value if successful, otherwise NULL. Decimal64(S) or NULL
toDecimal64OrZero(expr, S)
staticmethod
toDecimal64OrZero(expr, S)
expr— Expression returning a number or a string representation of a number.ExpressionS— Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have.UInt8
Returns a Decimal(18, S) value if successful, otherwise 0. Decimal64(S)
toDecimalString(number, scale)
staticmethod
toDecimalString(number, scale)
number— The numeric value to convert to a string. Can be any numeric type (Int, UInt, Float, Decimal).Int8orInt16orInt32orInt64orUInt8orUInt16orUInt32orUInt64orFloat32orFloat64orDecimalscale— The number of digits to display in the fractional part. The result will be rounded if necessary.UInt8
Returns a String representation of the number with exactly the specified number of fractional digits. String
toFixedString(s, N)
staticmethod
toFixedString(s, N)
s— String to convert.StringN— Length of the resulting FixedString.const UInt*
Returns a FixedString of length N. FixedString(N)
toFloat32(expr)
staticmethod
toFloat32(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 32-bit floating point value. Float32
toFloat32OrDefault(expr, default=None)
staticmethod
toFloat32OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.Float32
Returns a value of type Float32 if successful, otherwise returns the default value if passed or 0 if not. Float32
toFloat32OrNull(x)
staticmethod
toFloat32OrZero(x)
staticmethod
toFloat64(expr)
staticmethod
toFloat64(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 64-bit floating point value. Float64
toFloat64OrDefault(expr, default=None)
staticmethod
toFloat64OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.Float64
Returns a value of type Float64 if successful, otherwise returns the default value if passed or 0 if not. Float64
toFloat64OrNull(x)
staticmethod
toFloat64OrZero(x)
staticmethod
toHour(datetime)
staticmethod
toHour(datetime)
datetime— Date with time to get the hour from.DateTimeorDateTime64
Returns the hour (0-23) of datetime. UInt8
toIPv4(x)
staticmethod
toIPv4OrDefault(string, default=None)
staticmethod
toIPv4OrNull(x)
staticmethod
toIPv4OrZero(x)
staticmethod
toIPv6OrDefault(string, default=None)
staticmethod
toIPv6OrDefault(string[, default])
string— IP address string to convert. -default— Optional. The value to return if string has an invalid format. Returns the IPv6 address, otherwise::or the provided optional default if argumentstringhas an invalid format.IPv6
toIPv6OrNull(x)
staticmethod
toIPv6OrZero(x)
staticmethod
toISOWeek(datetime, timezone=None)
staticmethod
toISOYear(datetime)
staticmethod
toISOYear(datetime)
datetime— The value with date or date with time.DateorDate32orDateTimeorDateTime64
Returns the input value converted to an ISO year number. UInt16
toInt128(expr)
staticmethod
toInt128(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 128-bit integer value. Int128
toInt128OrDefault(expr, default=None)
staticmethod
toInt128OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.Int128
Returns a value of type Int128 if successful, otherwise returns the default value if passed, or 0 if not. Int128
toInt128OrNull(x)
staticmethod
toInt128OrZero(x)
staticmethod
toInt16(expr)
staticmethod
toInt16(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 16-bit integer value. Int16
toInt16OrDefault(expr, default=None)
staticmethod
toInt16OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.Int16
Returns a value of type Int16 if successful, otherwise returns the default value if passed, or 0 if not. Int16
toInt16OrNull(x)
staticmethod
toInt16OrZero(x)
staticmethod
toInt256(expr)
staticmethod
toInt256(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 256-bit integer value. Int256
toInt256OrDefault(expr, default=None)
staticmethod
toInt256OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.Int256
Returns a value of type Int256 if successful, otherwise returns the default value if passed, or 0 if not. Int256
toInt256OrNull(x)
staticmethod
toInt256OrZero(x)
staticmethod
toInt32(expr)
staticmethod
toInt32(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 32-bit integer value. Int32
toInt32OrDefault(expr, default=None)
staticmethod
toInt32OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.Int32
Returns a value of type Int32 if successful, otherwise returns the default value if passed or 0 if not. Int32
toInt32OrNull(x)
staticmethod
toInt32OrZero(x)
staticmethod
toInt64(expr)
staticmethod
toInt64(expr)
expr— Expression returning a number or a string representation of a number. Supported: values or string representations of type (U)Int, values of type Float. Unsupported: string representations of Float* values including NaN and Inf, string representations of binary and hexadecimal values.Expression
Returns a 64-bit integer value. Int64
toInt64OrDefault(expr, default=None)
staticmethod
toInt64OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.Int64
Returns a value of type Int64 if successful, otherwise returns the default value if passed, or 0 if not. Int64
toInt64OrNull(x)
staticmethod
toInt64OrZero(x)
staticmethod
toInt8(expr)
staticmethod
toInt8(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns an 8-bit integer value. Int8
toInt8OrDefault(expr, default=None)
staticmethod
toInt8OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.Int8
Returns a value of type Int8 if successful, otherwise returns the default value if passed, or 0 if not. Int8
toInt8OrNull(x)
staticmethod
toInt8OrZero(x)
staticmethod
toInterval(value, unit)
staticmethod
toInterval(value, unit)
value— The numeric value representing the number of units. Can be any numeric type.Int8orInt16orInt32orInt64orUInt8orUInt16orUInt32orUInt64orFloat32orFloat64unit— The unit of time. Must be a constant string. Valid values: 'nanosecond', 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'.String
Returns an Interval value of the specified type. The result type depends on the unit: IntervalNanosecond, IntervalMicrosecond, IntervalMillisecond, IntervalSecond, IntervalMinute, IntervalHour, IntervalDay, IntervalWeek, IntervalMonth, IntervalQuarter, or IntervalYear. Interval
toIntervalDay(n)
staticmethod
toIntervalHour(n)
staticmethod
toIntervalMicrosecond(n)
staticmethod
toIntervalMillisecond(n)
staticmethod
toIntervalMinute(n)
staticmethod
toIntervalMonth(n)
staticmethod
toIntervalNanosecond(n)
staticmethod
toIntervalQuarter(n)
staticmethod
toIntervalSecond(n)
staticmethod
toIntervalWeek(n)
staticmethod
toIntervalYear(n)
staticmethod
toJSONString(value)
staticmethod
toLastDayOfMonth(value)
staticmethod
toLastDayOfMonth(value)
value— The date or date with time to round up to the last day of the month.DateorDate32orDateTimeorDateTime64
Returns the date of the last day of the month for the given date or date with time. Date
toLastDayOfWeek(datetime, mode=None, timezone=None)
staticmethod
toLastDayOfWeek(datetime[, mode[, timezone]])
datetime— A date or date with time to convert.DateorDateTimeorDate32orDateTime64mode— Determines the first day of the week as described in thetoWeek()function. Default0.UInt8timezone— Optional. The timezone to use for the conversion. If not specified, the server's timezone is used.String
Returns the date of the nearest Saturday or Sunday, on or after the given date, depending on the mode Date or Date32 or DateTime or DateTime64
toLowCardinality(expr)
staticmethod
toLowCardinality(expr)
expr— Expression resulting in one of the supported data types.StringorFixedStringorDateorDateTimeor(U)Int*orFloat*
Returns the input value converted to the LowCardinality data type. LowCardinality
toMillisecond(datetime)
staticmethod
toMillisecond(datetime)
datetime— Date with time to get the millisecond from.DateTimeorDateTime64
Returns the millisecond in the minute (0 - 59) of datetime. UInt16
toMinute(datetime)
staticmethod
toMinute(datetime)
datetime— Date with time to get the minute from.DateTimeorDateTime64
Returns the minute of the hour (0 - 59) of datetime. UInt8
toModifiedJulianDay(date)
staticmethod
toModifiedJulianDay(date)
date— The date in String form.StringorFixedString
Returns Modified Julian Day number. Int32
toModifiedJulianDayOrNull(date)
staticmethod
toModifiedJulianDayOrNull(date)
date— Date in text form.StringorFixedString
Returns the modified Julian day number for valid date, otherwise null. Nullable(Int32)
toMonday(value)
staticmethod
toMonday(value)
value— Date or date with time to round down to the Monday of the week.DateorDate32orDateTimeorDateTime64
Returns the date of the Monday of the same week for the given date or date with time. Date
toMonth(datetime)
staticmethod
toMonth(datetime)
datetime— Date or date with time to get the month from.DateorDate32orDateTimeorDateTime64
Returns the month of the given date/time UInt8
toMonthNumSinceEpoch(date)
staticmethod
toMonthNumSinceEpoch(date)
date— A date or date with time.DateorDateTimeorDateTime64
Positive integer
toNullable(x)
staticmethod
toNullable(x)
x— A value of any non-compound type.Any
Returns the input value but of Nullable type. Nullable(Any)
toQuarter(datetime)
staticmethod
toQuarter(datetime)
datetime— Date or date with time to get the quarter of the year from.DateorDate32orDateTimeorDateTime64
Returns the quarter of the year for the given date/time UInt8
toRelativeDayNum(date)
staticmethod
toRelativeDayNum(date)
date— Date or date with time.DateorDateTimeorDateTime64
Returns the number of days from a fixed reference point in the past. UInt32
toRelativeHourNum(date)
staticmethod
toRelativeHourNum(date)
date— Date or date with time.DateorDateTimeorDateTime64
Returns the number of hours from a fixed reference point in the past. UInt32
toRelativeMinuteNum(date)
staticmethod
toRelativeMinuteNum(date)
date— Date or date with time.DateorDateTimeorDateTime64
Returns the number of minutes from a fixed reference point in the past. UInt32
toRelativeMonthNum(date)
staticmethod
toRelativeMonthNum(date)
date— Date or date with time.DateorDateTimeorDateTime64
Returns the number of months from a fixed reference point in the past. UInt32
toRelativeQuarterNum(date)
staticmethod
toRelativeQuarterNum(date)
date— Date or date with time.DateorDateTimeorDateTime64
Returns the number of quarters from a fixed reference point in the past. UInt32
toRelativeSecondNum(date)
staticmethod
toRelativeSecondNum(date)
date— Date or date with time.DateorDateTimeorDateTime64
Returns the number of seconds from a fixed reference point in the past. UInt32
toRelativeWeekNum(date)
staticmethod
toRelativeWeekNum(date)
date— Date or date with time.DateorDateTimeorDateTime64
Returns the number of weeks from a fixed reference point in the past. UInt32
toRelativeYearNum(date)
staticmethod
toRelativeYearNum(date)
date— Date or date with time.DateorDateTimeorDateTime64
Returns the number of years from a fixed reference point in the past. UInt16
toSecond(datetime)
staticmethod
toSecond(datetime)
datetime— Date with time to get the second from.DateTimeorDateTime64
Returns the second in the minute (0 - 59) of datetime. UInt8
toStartOfDay(datetime)
staticmethod
toStartOfFifteenMinutes(datetime)
staticmethod
toStartOfFifteenMinutes(datetime)
datetime— A date or date with time to round.DateTimeorDateTime64
Returns the date with time rounded to the start of the nearest fifteen-minute interval DateTime or DateTime64
toStartOfFiveMinutes(datetime)
staticmethod
toStartOfFiveMinutes(datetime)
datetime— A date with time to round.DateTimeorDateTime64
Returns the date with time rounded to the start of the nearest five-minute interval DateTime or DateTime64
toStartOfHour(datetime)
staticmethod
toStartOfHour(datetime)
datetime— A date with time to round.DateTimeorDateTime64
Returns the date with time rounded down to the start of the hour. DateTime or DateTime64
toStartOfISOYear(value)
staticmethod
toStartOfISOYear(value)
value— The date or date with time to round down to the first day of the ISO year.DateorDate32orDateTimeorDateTime64
Returns the first day of the ISO year for the given date or date with time. Date
toStartOfInterval(value, INTERVAL, x, unit, time_zone=None)
staticmethod
toStartOfInterval(value, INTERVAL x unit[, time_zone]) toStartOfInterval(value, INTERVAL x unit[, origin[, time_zone]])
value— Date or date with time value to round down.DateorDateTimeorDateTime64x— Interval length number. -unit— Interval unit: YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND, MILLISECOND, MICROSECOND, NANOSECOND. -time_zone— Optional. Time zone name as a string. -origin— Optional. Origin point for calculation (second overload only). Returns the start of the interval containing the input value.DateTime
toStartOfMicrosecond(datetime, timezone=None)
staticmethod
toStartOfMicrosecond(datetime[, timezone])
datetime— Date and time.DateTime64timezone— Optional. Timezone for the returned value. If not specified, the function uses the timezone of thevalueparameter.String
Input value with sub-microseconds DateTime64
toStartOfMillisecond(datetime, timezone=None)
staticmethod
toStartOfMillisecond(datetime[, timezone])
datetime— Date and time.DateTime64timezone— Optional. Timezone for the returned value. If not specified, the function uses the timezone of thevalueparameter.String
Input value with sub-milliseconds. DateTime64
toStartOfMinute(datetime)
staticmethod
toStartOfMinute(datetime)
datetime— A date with time to round.DateTimeorDateTime64
Returns the date with time rounded down to the start of the minute. DateTime or DateTime64
toStartOfMonth(value)
staticmethod
toStartOfMonth(value)
value— The date or date with time to round down to the first day of the month.DateorDate32orDateTimeorDateTime64
Returns the first day of the month for the given date or date with time. Date
toStartOfNanosecond(datetime, timezone=None)
staticmethod
toStartOfNanosecond(datetime[, timezone])
datetime— Date and time.DateTime64timezone— Optional. Timezone for the returned value. If not specified, the function uses the timezone of thevalueparameter.String
Input value with nanoseconds. DateTime64
toStartOfQuarter(value)
staticmethod
toStartOfQuarter(value)
value— The date or date with time to round down to the first day of the quarter.DateorDate32orDateTimeorDateTime64
Returns the first day of the quarter for the given date or date with time. Date
toStartOfSecond(datetime, timezone=None)
staticmethod
toStartOfSecond(datetime[, timezone])
datetime— Date and time to truncate sub-seconds from.DateTime64timezone— Optional. Timezone for the returned value. If not specified, the function uses the timezone of thevalueparameter.String
Returns the input value without sub-seconds. DateTime64
toStartOfTenMinutes(datetime)
staticmethod
toStartOfTenMinutes(datetime)
datetime— A date with time.DateTimeorDateTime64
Returns the date with time rounded to the start of the nearest ten-minute interval DateTime or DateTime64
toStartOfWeek(datetime, mode=None, timezone=None)
staticmethod
toStartOfWeek(datetime[, mode[, timezone]])
datetime— A date or date with time to convert.DateorDateTimeorDate32orDateTime64mode— Determines the first day of the week as described in thetoWeek()function. Default0.UInt8timezone— The timezone to use for the conversion. If not specified, the server's timezone is used.String
Returns the date of the nearest Sunday or Monday on, or prior to, the given date, depending on the mode Date or Date32 or DateTime or DateTime64
toStartOfYear(value)
staticmethod
toStartOfYear(value)
value— The date or date with time to round down.DateorDate32orDateTimeorDateTime64
Returns the first day of the year for the given date/time Date
toString(value, timezone=None)
staticmethod
toStringCutToZero(s)
staticmethod
toStringCutToZero(s)
s— String or FixedString to process.StringorFixedString
Returns a String containing the characters before the first null byte. String
toTime(x)
staticmethod
toTime64(x)
staticmethod
toTime64(x)
x— Input value to convert.StringorFixedStringorDateTime64or(U)Int*orFloat*
Returns the converted input value with microsecond precision. Time64(6)
toTime64OrNull(x)
staticmethod
toTime64OrZero(x)
staticmethod
toTimeOrNull(x)
staticmethod
toTimeOrZero(x)
staticmethod
toTimeWithFixedDate(date, timezone=None)
staticmethod
toTimeWithFixedDate(date[, timezone])
date— Date to convert to a time.DateorDateTimeorDateTime64timezone— Optional. Timezone for the returned value.String
Returns the time component of a date or date with time in the form of an offset to a fixed point in time (selected as 1970-01-02, currently). DateTime
toTimezone(datetime, timezone)
staticmethod
toTimezone(datetime, timezone)
date— The value to convert.DateTimeorDateTime64timezone— The target time zone name.String
Returns the same timestamp as the input, but with the specified time zone DateTime or DateTime64
toTypeName(x)
staticmethod
toUInt128(expr)
staticmethod
toUInt128(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 128-bit unsigned integer value. UInt128
toUInt128OrDefault(expr, default=None)
staticmethod
toUInt128OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.UInt128
Returns a value of type UInt128 if successful, otherwise returns the default value if passed, or 0 if not. UInt128
toUInt128OrNull(x)
staticmethod
toUInt128OrZero(x)
staticmethod
toUInt16(expr)
staticmethod
toUInt16(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 16-bit unsigned integer value. UInt16
toUInt16OrDefault(expr, default=None)
staticmethod
toUInt16OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.UInt16
Returns a value of type UInt16 if successful, otherwise returns the default value if passed, or 0 if not. UInt16
toUInt16OrNull(x)
staticmethod
toUInt16OrZero(x)
staticmethod
toUInt256(expr)
staticmethod
toUInt256(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 256-bit unsigned integer value. UInt256
toUInt256OrDefault(expr, default=None)
staticmethod
toUInt256OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.UInt256
Returns a value of type UInt256 if successful, otherwise returns the default value if passed, or 0 if not. UInt256
toUInt256OrNull(x)
staticmethod
toUInt256OrZero(x)
staticmethod
toUInt32(expr)
staticmethod
toUInt32(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 32-bit unsigned integer value. UInt32
toUInt32OrDefault(expr, default=None)
staticmethod
toUInt32OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.UInt32
Returns a value of type UInt32 if successful, otherwise returns the default value if passed, or 0 if not. UInt32
toUInt32OrNull(x)
staticmethod
toUInt32OrZero(x)
staticmethod
toUInt64(expr)
staticmethod
toUInt64(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns a 64-bit unsigned integer value. UInt64
toUInt64OrDefault(expr, default=None)
staticmethod
toUInt64OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.UInt64
Returns a value of type UInt64 if successful, otherwise returns the default value if passed, or 0 if not. UInt64
toUInt64OrNull(x)
staticmethod
toUInt64OrZero(x)
staticmethod
toUInt8(expr)
staticmethod
toUInt8(expr)
expr— Expression returning a number or a string representation of a number.Expression
Returns an 8-bit unsigned integer value. UInt8
toUInt8OrDefault(expr, default=None)
staticmethod
toUInt8OrDefault(expr[, default])
expr— Expression returning a number or a string representation of a number.Stringor(U)Int*orFloat*default— Optional. The default value to return if parsing is unsuccessful.UInt8
Returns a value of type UInt8 if successful, otherwise returns the default value if passed, or 0 if not. UInt8
toUInt8OrNull(x)
staticmethod
toUInt8OrZero(x)
staticmethod
toUTCTimestamp(datetime, time_zone)
staticmethod
toUTCTimestamp(datetime, time_zone)
datetime— A date or date with time type const value or an expression.DateTimeorDateTime64time_zone— A String type const value or an expression representing the time zone.String
Returns a date or date with time in UTC timezone. DateTime or DateTime64
toUUID(string)
staticmethod
toUUID(string)
string— UUID as a string.StringorFixedString
Returns a UUID from the string representation of the UUID. UUID
toUUIDOrDefault(string, default)
staticmethod
toUUIDOrDefault(string, default)
string— String of 36 characters or FixedString(36) to be converted to UUID. -default— UUID value to be returned if the first argument cannot be converted to UUID type. Returns the converted UUID if successful, or the default UUID if conversion fails.UUID
toUUIDOrNull(x)
staticmethod
toUUIDOrZero(x)
staticmethod
toUnixTimestamp(date, timezone=None)
staticmethod
toUnixTimestamp64Micro(value)
staticmethod
toUnixTimestamp64Micro(value)
value— DateTime64 value with any precision.DateTime64
Returns a Unix timestamp in microseconds. Int64
toUnixTimestamp64Milli(value)
staticmethod
toUnixTimestamp64Milli(value)
value— DateTime64 value with any precision.DateTime64
Returns a Unix timestamp in milliseconds. Int64
toUnixTimestamp64Nano(value)
staticmethod
toUnixTimestamp64Nano(value)
value— DateTime64 value with any precision.DateTime64
Returns a Unix timestamp in nanoseconds. Int64
toUnixTimestamp64Second(value)
staticmethod
toUnixTimestamp64Second(value)
value— DateTime64 value with any precision.DateTime64
Returns a Unix timestamp in seconds. Int64
toValidUTF8(s)
staticmethod
toWeek(datetime, mode=None, time_zone=None)
staticmethod
toWeek(datetime[, mode[, time_zone]])
datetime— Date or date with time to get the week number from.DateorDateTimemode— Optional. A mode0to9determines the first day of the week and the range of the week number. Default0. -time_zone— Optional. Time zone.String
Returns the week number according to the specified mode. UInt32
toYYYYMM(datetime, timezone=None)
staticmethod
toYYYYMM(datetime[, timezone])
datetime— A date or date with time to convert.DateorDate32orDateTimeorDateTime64timezone— Optional. Timezone for the conversion. If provided, the timezone must be a string constant.String
Returns a UInt32 number containing the year and month number (YYYY * 100 + MM). UInt32
toYYYYMMDD(datetime, timezone=None)
staticmethod
toYYYYMMDD(datetime[, timezone])
datetime— A date or date with time to convert.DateorDate32orDateTimeorDateTime64timezone— Optional. Timezone for the conversion. If provided, the timezone must be a string constant.String
Returns a UInt32 number containing the year, month and day (YYYY * 10000 + MM * 100 + DD). UInt32
toYYYYMMDDhhmmss(datetime, timezone=None)
staticmethod
toYYYYMMDDhhmmss(datetime[, timezone])
datetime— Date or date with time to convert.DateorDate32orDateTimeorDateTime64timezone— Optional. Timezone for the conversion. If provided, the timezone must be a string constant.String
Returns a UInt64 number containing the year, month, day, hour, minute and second (YYYY * 10000000000 + MM * 100000000 + DD * 1000000 + hh * 10000 + mm * 100 + ss). UInt64
toYear(datetime)
staticmethod
toYear(datetime)
datetime— Date or date with time to get the year from.DateorDate32orDateTimeorDateTime64
Returns the year of the given Date or DateTime UInt16
toYearNumSinceEpoch(date)
staticmethod
toYearNumSinceEpoch(date)
date— A date or date with time to convert.DateorDateTimeorDateTime64
Positive integer
toYearWeek(datetime, mode=None, timezone=None)
staticmethod
toYearWeek(datetime[, mode[, timezone]])
datetime— Date or date with time to get the year and week of.DateorDateTimemode— Optional. A mode0to9determines the first day of the week and the range of the week number. Default0. -timezone— Optional. Time zone.String
Returns year and week number as a combined integer value. UInt32
today()
staticmethod
today()
Returns the current date Date
tokens(value)
staticmethod
tokens(value) -- 'splitByNonAlpha' tokenizer tokens(value, 'splitByNonAlpha') tokens(value, 'splitByString'[, separators]) tokens(value, 'ngrams'[, n]) tokens(value, 'sparseGrams'[, min_length, max_length[, min_cutoff_length]]) tokens(value, 'array') tokens(value, 'unicode_word'[, stop_words])
value— The input string.StringorFixedStringtokenizer— The tokenizer to use. Valid arguments aresplitByNonAlpha,ngrams,splitByString,array,sparseGrams, andunicode_word. Optional, if not set explicitly, defaults tosplitByNonAlpha.const Stringn— Only relevant if argumenttokenizerisngrams: An optional parameter which defines the length of the ngrams. If not set explicitly, defaults to3.const UInt8separators— Only relevant if argumenttokenizerissplit: An optional parameter which defines the separator strings. If not set explicitly, defaults to[' '].const Array(String)min_length— Only relevant if argumenttokenizerissparseGrams: An optional parameter which defines the minimum gram length, defaults to 3.const UInt8max_length— Only relevant if argumenttokenizerissparseGrams: An optional parameter which defines the maximum gram length, defaults to 100.const UInt8min_cutoff_length— Only relevant if argumenttokenizerissparseGrams: An optional parameter which defines the minimum cutoff length.const UInt8stop_words— Only relevant if argumenttokenizerisunicode_word: An optional parameter which defines the stop words. If not set explicitly, defaults to common CJK punctuation marks.const Array(String)
Returns the resulting array of tokens from input string. Array
tokensForLikePattern(value, tokenizer=None, tokenizer_specific_arguments=None)
staticmethod
tokensForLikePattern(value[, tokenizer[, tokenizer_specific_arguments...]])
value— The input string.StringorFixedStringtokenizer— The tokenizer to use. Valid arguments aresplitByNonAlpha,ngrams,splitByString,array,sparseGrams, andunicode_word. Optional, if not set explicitly, defaults tosplitByNonAlpha.const Stringn— Only relevant if argumenttokenizerisngrams: An optional parameter which defines the length of the ngrams. If not set explicitly, defaults to3.const UInt8separators— Only relevant if argumenttokenizerissplit: An optional parameter which defines the separator strings. If not set explicitly, defaults to[' '].const Array(String)min_length— Only relevant if argumenttokenizerissparseGrams: An optional parameter which defines the minimum gram length, defaults to 3.const UInt8max_length— Only relevant if argumenttokenizerissparseGrams: An optional parameter which defines the maximum gram length, defaults to 100.const UInt8min_cutoff_length— Only relevant if argumenttokenizerissparseGrams: An optional parameter which defines the minimum cutoff length.const UInt8stop_words— Only relevant if argumenttokenizerisunicode_word: An optional parameter which defines the stop words. If not set explicitly, defaults to common CJK punctuation marks.const Array(String)
Returns the resulting array of tokens from input string. Array
topK(N)
staticmethod
topKWeighted(N)
staticmethod
topKWeighted(N)(column, weight) topKWeighted(N, load_factor)(column, weight) topKWeighted(N, load_factor, 'counts')(column, weight)
column— The name of the column for which to find the most frequent values. -weight— The weight. Every value is accountedweighttimes for frequency calculation.UInt64
Returns an array of the values with maximum approximate sum of weights. Array
topLevelDomain(url)
staticmethod
topLevelDomainRFC(url)
staticmethod
transactionID()
staticmethod
transactionID()
Returns a tuple consisting of start_csn, local_tid and host_id.
- start_csn: Global sequential number, the newest commit timestamp that was seen when this transaction began.
- local_tid: Local sequential number that is unique for each transaction started by this host within a specific start_csn.
- host_id: UUID of the host that has started this transaction.
Tuple(UInt64, UInt64, UUID)
transactionLatestSnapshot()
staticmethod
transactionLatestSnapshot()
Returns the latest snapshot (CSN) of a transaction. UInt64
transactionOldestSnapshot()
staticmethod
transactionOldestSnapshot()
Returns the oldest snapshot (CSN) of a transaction. UInt64
transform(x, array_from, array_to, default=None)
staticmethod
transform(x, array_from, array_to[, default])
x— Value to transform.(U)Int*orDecimalorFloat*orStringorDateorDateTimearray_from— Constant array of values to search for matches.Array((U)Int*)orArray(Decimal)orArray(Float*)orArray(String)orArray(Date)orArray(DateTime)array_to— Constant array of values to return for corresponding matches inarray_from.Array((U)Int*)orArray(Decimal)orArray(Float*)orArray(String)orArray(Date)orArray(DateTime)default— Optional. Value to return ifxis not found inarray_from. If omitted, returns x unchanged.(U)Int*orDecimalorFloat*orStringorDateorDateTime
Returns the corresponding value from array_to if x matches an element in array_from, otherwise returns default (if provided) or x (if default not provided). Any
translate(s, from_, to)
staticmethod
translate(s, from, to)
s— The input string to translate.Stringfrom— A constant ASCII string containing characters to replace.const Stringto— A constant ASCII string containing replacement characters.const String
Returns a string with character translations applied. String
translateUTF8(s, from_, to)
staticmethod
translateUTF8(s, from, to)
s— UTF-8 input string to translate.Stringfrom— A constant UTF-8 string containing characters to replace.const Stringto— A constant UTF-8 string containing replacement characters.const String
Returns a String data type value. String
trimBoth(s, trim_characters=None)
staticmethod
trimLeft(input, trim_characters=None)
staticmethod
trimRight(s, trim_characters=None)
staticmethod
trunc(x, N=None)
staticmethod
tryBase32Decode(encoded)
staticmethod
tryBase58Decode(encoded)
staticmethod
tryBase64Decode(encoded)
staticmethod
tryBase64URLDecode(encoded)
staticmethod
tryDecrypt(mode, ciphertext, key, iv=None, aad=None)
staticmethod
tryDecrypt(mode, ciphertext, key[, iv, aad])
mode— Decryption mode.Stringciphertext— Encrypted text that should be decrypted.Stringkey— Decryption key.Stringiv— Optional. Initialization vector. Required for-gcmmodes, optional for other modes.Stringaad— Optional. Additional authenticated data. Won't decrypt if this value is incorrect. Works only in-gcmmodes, for other modes throws an exception.String
Returns the decrypted String, or NULL if decryption fails. Nullable(String)
tryIdnaEncode(s)
staticmethod
tryPunycodeDecode(s)
staticmethod
tumble(time_attr, interval, timezone=None)
staticmethod
tumble(time_attr, interval[, timezone])
time_attr— Date and time.DateTimeinterval— Window interval in Interval.Intervaltimezone— Optional. Timezone name.String
Returns the inclusive lower and exclusive upper bound of the corresponding tumbling window. Tuple(DateTime, DateTime)
tumbleEnd(time_attr, interval, timezone=None)
staticmethod
tumbleStart(time_attr, interval, timezone=None)
staticmethod
tuple(t1=None, t2=None)
staticmethod
tuple([t1[, t2[ ...]])
tupleConcat(tuple1, tuple2=None)
staticmethod
tupleDivide(t1, t2)
staticmethod
tupleDivide(t1, t2)
t1— First tuple.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)t2— Second tuple.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)
Returns tuple with the result of division. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleDivideByNumber(tuple, number)
staticmethod
tupleDivideByNumber(tuple, number)
tuple— Tuple to divide.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)number— Divider.(U)Int*orFloat*orDecimal
Returns a tuple with divided elements. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleElement(tuple, index, name, default_value=None)
staticmethod
tupleElement(tuple, index|name[, default_value])
tuple— A tuple or array of tuples.Tuple(T)orArray(Tuple(T))index— Column index, starting from 1.const UInt8/16/32/64name— Name of the element.const Stringdefault_value— Default value returned when index is out of bounds or element doesn't exist.Any
Returns the element at the specified index or name. Any
tupleHammingDistance(t1, t2)
staticmethod
tupleHammingDistance(t1, t2)
Returns the Hamming distance. UInt8/16/32/64
tupleIntDiv(tuple_num, tuple_div)
staticmethod
tupleIntDiv(tuple_num, tuple_div)
tuple_num— Tuple of numerator values.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)tuple_div— Tuple of divisor values.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)
Returns a tuple of the quotients. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleIntDivByNumber(tuple_num, div)
staticmethod
tupleIntDivByNumber(tuple_num, div)
tuple_num— Tuple of numerator values.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)div— The divisor value.(U)Int*orFloat*orDecimal
Returns a tuple of the quotients. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleIntDivOrZero(tuple_num, tuple_div)
staticmethod
tupleIntDivOrZero(tuple_num, tuple_div)
tuple_num— Tuple of numerator values.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)tuple_div— Tuple of divisor values.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)
Returns tuple of the quotients. Returns 0 for quotients where the divisor is 0. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleIntDivOrZeroByNumber(tuple_num, div)
staticmethod
tupleIntDivOrZeroByNumber(tuple_num, div)
tuple_num— Tuple of numerator values.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)div— The divisor value.(U)Int*orFloat*orDecimal
Returns a tuple of the quotients with 0 for quotients where the divisor is 0. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleMinus(t1, t2)
staticmethod
tupleMinus(t1, t2)
t1— First tuple.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)t2— Second tuple.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)
Returns a tuple containing the results of the subtractions. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleModulo(tuple_num, tuple_mod)
staticmethod
tupleModulo(tuple_num, tuple_mod)
tuple_num— Tuple of numerator values.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)tuple_mod— Tuple of modulus values.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)
Returns tuple of the remainders of division. An error is thrown for division by zero. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleModuloByNumber(tuple_num, div)
staticmethod
tupleModuloByNumber(tuple_num, div)
tuple_num— Tuple of numerator elements.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)div— The divisor value.(U)Int*orFloat*orDecimal
Returns tuple of the remainders of division. An error is thrown for division by zero. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleMultiply(t1, t2)
staticmethod
tupleMultiply(t1, t2)
t1— First tuple.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)t2— Second tuple.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)
Returns a tuple with the results of the multiplications. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleMultiplyByNumber(tuple, number)
staticmethod
tupleMultiplyByNumber(tuple, number)
tuple— Tuple to multiply.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)number— Multiplier.(U)Int*orFloat*orDecimal
Returns a tuple with multiplied elements. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleNames(tuple)
staticmethod
tupleNames(tuple)
tupleNegate(t)
staticmethod
tupleNegate(t)
t— Tuple to negate.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)
Returns a tuple with the result of negation. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tuplePlus(t1, t2)
staticmethod
tuplePlus(t1, t2)
t1— First tuple.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)t2— Second tuple.Tuple((U)Int*)orTuple(Float*)orTuple(Decimal)
Returns a tuple containing the sums of corresponding input tuple arguments. Tuple((U)Int*) or Tuple(Float*) or Tuple(Decimal)
tupleToNameValuePairs(tuple)
staticmethod
tupleToNameValuePairs(tuple)
tuple— Named tuple with any types of values.Tuple(n1 T1[, n2 T2, ...])
Returns an array with (name, value) pairs. Array(Tuple(String, T))
unbin(arg)
staticmethod
unhex(arg)
staticmethod
unhex(arg)
arg— A string containing any number of hexadecimal digits.StringorFixedString
Returns a binary string (BLOB). String
uniq(x)
staticmethod
uniqCombined(HLL_precision)
staticmethod
uniqCombined64(HLL_precision)
staticmethod
uniqExact(x)
staticmethod
uniqHLL12(x)
staticmethod
uniqTheta(x)
staticmethod
uniqUpTo(*args)
staticmethod
upper(s)
staticmethod
uptime()
staticmethod
uptime()
Returns the server uptime in seconds. UInt32
validateNestedArraySizes(*args)
staticmethod
varPop(x)
staticmethod
varPopStable(x)
staticmethod
varSamp(x)
staticmethod
varSampStable(x)
staticmethod
variantElement(variant, type_name, default_value=None)
staticmethod
variantElement(variant, type_name[, default_value])
variant— Variant column.Varianttype_name— The name of the variant type to extract.Stringdefault_value— The default value that will be used if variant doesn't have variant with specified type. Can be any type. Optional.Any
Returns a column with the specified variant type extracted from the Variant column. Any
variantType(variant)
staticmethod
version()
staticmethod
version()
Returns the current version of ClickHouse. String
visibleWidth(x)
staticmethod
welchTTest(confidence_level=None)
staticmethod
welchTTest([confidence_level])(sample_data, sample_index)
sample_data— Sample data.Int*orUInt*orFloat*orDecimal*sample_index— Sample index.Int*orUInt*
Returns a Tuple with two or four elements (if the optional confidence_level is specified): calculated t-statistic, calculated p-value, and optionally calculated confidence-interval-low and confidence-interval-high. Tuple(Float64, Float64) or Tuple(Float64, Float64, Float64, Float64)
widthBucket(operand, low, high, count)
staticmethod
widthBucket(operand, low, high, count)
operand— The value for which to determine the bucket.(U)Int8/16/32/64low— The lower bound of the histogram range.(U)Int8/16/32/64high— The upper bound of the histogram range.(U)Int8/16/32/64count— The number of equal-width buckets. Cannot be zero.UInt8/16/32/64
Returns the bucket number as an integer. Returns 0 if operand < low, returns count+1 if operand >= high. UInt8/16/32/64
windowFunnel(*args)
staticmethod
windowID(time_attr, interval, timezone=None)
staticmethod
wkb(geometry)
staticmethod
wkb(geometry)
geometry— The input geometry type to convert into WKB.
wkt(geometry)
staticmethod
wkt(geometry)
geometry— Geometry object (Point, Ring, Polygon, MultiPolygon).PointorRingorPolygonorMultiPolygon
Returns the WKT string representation of the geometry. String
wordShingleMinHash(string, shinglesize=None, hashnum=None)
staticmethod
wordShingleMinHash(string[, shinglesize, hashnum])
string— String for which to compute the hash.Stringshinglesize— Optional. The size of a word shingle, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two hashes — the minimum and the maximum. Tuple(UInt64, UInt64)
wordShingleMinHashArg(string, shinglesize=None, hashnum=None)
staticmethod
wordShingleMinHashArg(string[, shinglesize, hashnum])
string— String for which to compute the hash.Stringshinglesize— Optional. The size of a word shingle, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two tuples with hashnum word shingles each. Tuple(Tuple(String))
wordShingleMinHashArgCaseInsensitive(string, shinglesize=None, hashnum=None)
staticmethod
wordShingleMinHashArgCaseInsensitive(string[, shinglesize, hashnum])
string— String for which to compute the hash.Stringshinglesize— Optional. The size of a word shingle, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two tuples with hashnum word shingles each. Tuple(Tuple(String))
wordShingleMinHashArgCaseInsensitiveUTF8(string, shinglesize=None, hashnum=None)
staticmethod
wordShingleMinHashArgCaseInsensitiveUTF8(string[, shinglesize, hashnum])
string— String for which to compute the hash.Stringshinglesize— Optional. The size of a word shingle, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two tuples with hashnum word shingles each. Tuple(Tuple(String))
wordShingleMinHashArgUTF8(string, shinglesize=None, hashnum=None)
staticmethod
wordShingleMinHashArgUTF8(string[, shinglesize, hashnum])
string— String for which to compute the hash.Stringshinglesize— Optional. The size of a word shingle, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two tuples with hashnum word shingles each. Tuple(Tuple(String))
wordShingleMinHashCaseInsensitive(string, shinglesize=None, hashnum=None)
staticmethod
wordShingleMinHashCaseInsensitive(string[, shinglesize, hashnum])
string— String for which to compute the hash.Stringshinglesize— Optional. The size of a word shingle, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two hashes — the minimum and the maximum. Tuple(UInt64, UInt64)
wordShingleMinHashCaseInsensitiveUTF8(string, shinglesize=None, hashnum=None)
staticmethod
wordShingleMinHashCaseInsensitiveUTF8(string[, shinglesize, hashnum])
string— String for which to compute the hash.Stringshinglesize— Optional. The size of a word shingle, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two hashes — the minimum and the maximum. Tuple(UInt64, UInt64)
wordShingleMinHashUTF8(string, shinglesize=None, hashnum=None)
staticmethod
wordShingleMinHashUTF8(string[, shinglesize, hashnum])
string— String for which to compute the hash.Stringshinglesize— Optional. The size of a word shingle, any number from1to25. The default value is3.UInt8hashnum— Optional. The number of minimum and maximum hashes used to calculate the result, any number from1to25. The default value is6.UInt8
Returns a tuple with two hashes — the minimum and the maximum. Tuple(UInt64, UInt64)
wordShingleSimHash(string, shinglesize=None)
staticmethod
wordShingleSimHashCaseInsensitive(string, shinglesize=None)
staticmethod
wordShingleSimHashCaseInsensitiveUTF8(string, shinglesize=None)
staticmethod
wordShingleSimHashUTF8(string, shinglesize=None)
staticmethod
wyHash64(arg)
staticmethod
xor(val1, val2)
staticmethod
xor(val1, val2[, ...])
val1, val2[, ...]— List of at least two values.Nullable((U)Int*)orNullable(Float*)
Returns:
- 1, for two values: if one of the values evaluates to false and other does not
- 0, for two values: if both values evaluate to false or to both true
- NULL, if at least one of the inputs is NULL.
Nullable(UInt8)
xxHash32(arg)
staticmethod
xxHash64(arg)
staticmethod
xxh3(expr)
staticmethod
xxh3_128(expr)
staticmethod
yesterday()
staticmethod
yesterday()
Returns yesterday's date. Date
zookeeperSessionUptime()
staticmethod
zookeeperSessionUptime()
Returns the uptime of the current ZooKeeper session in seconds. UInt32