Scalar functions
Functions that return one value per row. Names are case-insensitive. Full-text search uses hasToken(column, text), which also has the forms searchAll and searchAny, and bm25Score, which ranks the rows.
| Name | Other names | Arguments | Description |
|---|---|---|---|
abs | (x) | Returns the absolute value of a number. | |
acos | (x) | Returns the arc cosine of a number. | |
add_days | addDays | (x, y) | Adds a number of days to a date or timestamp. |
add_hours | addHours | (x, y) | Adds a number of hours to a date or timestamp. |
add_minutes | addMinutes | (x, y) | Adds a number of minutes to a date or timestamp. |
add_months | addMonths | (x, y) | Adds a number of months to a date or timestamp. |
add_quarters | addQuarters | (x, y) | Adds a number of quarters to a date or timestamp. |
add_seconds | addSeconds | (x, y) | Adds a number of seconds to a date or timestamp. |
add_weeks | addWeeks | (x, y) | Adds a number of weeks to a date or timestamp. |
add_years | addYears | (x, y) | Adds a number of years to a date or timestamp. |
age | (unit, x, y) | Returns the number of full units that have elapsed between two dates or timestamps. | |
array_string_concat | arrayStringConcat | (x[, y]) | Joins the elements of an array of strings, with an optional separator. |
array_with_constant | arrayWithConstant | (x, y) | Returns an array of a given length filled with one value. |
asin | (x) | Returns the arc sine of a number. | |
assume_not_null | assumeNotNull | (x) | Returns the value of a nullable expression as if it could not be NULL. |
atan | (x) | Returns the arc tangent of a number. | |
atan2 | (x, y) | Returns the angle in radians of the point given by its y and x coordinates. | |
base64_decode | base64Decode | (x) | Decodes a Base64 string. |
base64_encode | base64Encode | (x) | Encodes a string as Base64. |
bin | (x) | Returns the binary text form of a value. | |
bit_and | bitAnd | (x, y) | Returns the bitwise AND of two integers. |
bit_count | bitCount | (x) | Returns the number of bits set to 1 in an integer. |
bit_not | bitNot | (x) | Returns the bitwise complement of an integer. |
bit_or | bitOr | (x, y) | Returns the bitwise OR of two integers. |
bit_positions_to_array | bitPositionsToArray | (x) | Returns the positions of the set bits of an integer as an array. |
bit_shift_left | bitShiftLeft | (x, y) | Shifts the bits of an integer to the left. |
bit_shift_right | bitShiftRight | (x, y) | Shifts the bits of an integer to the right. |
bit_test | bitTest | (x, y) | Returns the value of one bit of an integer. |
bit_test_all | bitTestAll | (x1, x2, ...) | Returns 1 when all the listed bits of an integer are set. |
bit_test_any | bitTestAny | (x1, x2, ...) | Returns 1 when at least one of the listed bits of an integer is set. |
bit_xor | bitXor | (x, y) | Returns the bitwise XOR of two integers. |
bitmask_to_array | bitmaskToArray | (x) | Returns the powers of two that make up an integer as an array. |
bitmask_to_list | bitmaskToList | (x) | Returns the powers of two that make up an integer as comma-separated text. |
bm25_score | bm25Score | (x, y) | Returns the BM25 relevance score of a text column for the given search terms. |
byte_swap | byteSwap | (x) | Reverses the byte order of an integer. |
cast | (x AS type) | Converts a value to the type named after AS. | |
cbrt | (x) | Returns the cube root of a number. | |
ceil | ceiling | (x[, y]) | Rounds a number up to the number of decimal places given as the optional second argument. |
char | (x1, x2, ...) | Builds a string from byte values. | |
city_hash64 | cityHash64 | (x) | Returns the CityHash 64-bit hash of a value. |
coalesce | (x1, x2, ...) | Returns the first argument that is not NULL. | |
concat | (x1, x2, ...) | Joins its arguments into one string. | |
concat_with_separator | concatWithSeparator | (x1, x2, ...) | Joins its arguments into one string with a separator between them. |
cos | (x) | Returns the cosine of a number. | |
cosh | (x) | Returns the hyperbolic cosine of a number. | |
cosine_distance | cosineDistance | (x, y) | Returns the cosine distance between two vectors. |
count_matches | countMatches | (x, y) | Returns the number of matches of a regular expression in a string. |
cut_fragment | cutFragment | (x) | Removes the fragment from a URL. |
cut_query_string | cutQueryString | (x) | Removes the query string from a URL. |
cut_query_string_and_fragment | cutQueryStringAndFragment | (x) | Removes the query string and the fragment from a URL. |
cut_to_first_significant_subdomain | cutToFirstSignificantSubdomain | (x) | Returns the part of the host of a URL up to the first significant subdomain. |
cut_www | cutWWW | (x) | Removes a leading www from the host of a URL. |
date_add | dateAdd, date_add | (unit, x, y) | Adds a number of units to a date or timestamp. |
date_diff | dateDiff, date_diff | (unit, x, y) | Returns the number of unit boundaries crossed between two dates or timestamps. |
date_name | dateName | (unit, x) | Returns the name of one part of a date or timestamp, such as the month name, as text. |
date_sub | dateSub, date_sub | (unit, x, y) | Subtracts a number of units from a date or timestamp. |
date_trunc | (unit, x) | Rounds a date or timestamp down to the start of the given unit. | |
decode_url_component | decodeURLComponent | (x) | Decodes the percent escapes of a URL component. |
decode_url_form_component | decodeURLFormComponent | (x) | Decodes the percent escapes of a URL form component, where a plus sign is a space. |
degrees | (x) | Converts an angle from radians to degrees. | |
dict_get | dictGet | (x1, x2, ...) | Returns the value of an attribute from a dictionary for a key. |
dict_get_or_default | dictGetOrDefault | (x1, x2, ...) | Returns the value of an attribute from a dictionary for a key, or a given default when the key is missing. |
dict_get_or_null | dictGetOrNull | (x1, x2, ...) | Returns the value of an attribute from a dictionary for a key, or NULL when the key is missing. |
dict_has | dictHas | (x1, x2, ...) | Returns 1 when a dictionary has the key and 0 otherwise. |
display_name | displayName | () | Returns the host name of the server. |
domain | (x) | Returns the host name of a URL. | |
domain_without_www | domainWithoutWWW | (x) | Returns the host name of a URL without a leading www. |
dot_product | dotProduct | (x, y) | Returns the dot product of two vectors. |
e | () | Returns the number e. | |
edit_distance | editDistance, levenshteinDistance | (x, y) | Returns the Levenshtein edit distance between two strings. |
empty | (x) | Returns 1 when a string or array is empty and 0 otherwise. | |
encode_url_component | encodeURLComponent | (x) | Encodes a string as a URL component with percent escapes. |
encode_url_form_component | encodeURLFormComponent | (x) | Encodes a string as a URL form component, where a space becomes a plus sign. |
ends_with | endsWith | (x, y) | Returns 1 when a string ends with the given suffix and 0 otherwise. |
erf | (x) | Returns the error function of a number. | |
erfc | (x) | Returns the complementary error function of a number. | |
eval_ml_method | evalMLMethod | (model, feature1, ...) | Applies a trained model state to feature values and returns the prediction. |
exp | (x) | Returns e raised to a power. | |
exp10 | (x) | Returns 10 raised to a power. | |
exp2 | (x) | Returns 2 raised to a power. | |
extract | (unit FROM x) | Returns one field of a date or timestamp, such as the year or the hour, named by a unit. | |
extract_all | extractAll | (x, y) | Returns an array of all matches of a regular expression in a string. |
extract_groups | extractGroups | (x, y) | Returns the capture groups of the first match of a regular expression as an array. |
extract_regex | (x, y) | Returns the first capture group of the first match of a regular expression, or an empty string when nothing matches. | |
extract_url_parameter | extractURLParameter | (x, y) | Returns the value of a named query parameter of a URL. |
extract_url_parameter_names | extractURLParameterNames | (x) | Returns the names of the query parameters of a URL as an array. |
extract_url_parameters | extractURLParameters | (x) | Returns the query parameters of a URL as an array of name=value strings. |
factorial | (x) | Returns the factorial of a non-negative integer. | |
floor | (x[, y]) | Rounds a number down to the number of decimal places given as the optional second argument. | |
format | (x1, x2, ...) | Fills the placeholders of a format string with the following arguments. | |
format_date_time | formatDateTime, formatDatetime | (x, y) | Formats a date or timestamp as text using a format string with percent codes. |
format_readable_quantity | formatReadableQuantity | (x[, y]) | Formats a number as text with a decimal unit, such as 1.00 million. |
format_readable_size | formatReadableSize, FORMAT_BYTES | (x[, y]) | Formats a number of bytes as text with a binary unit, such as 1.00 KiB. |
fragment | (x) | Returns the fragment of a URL without the leading hash sign. | |
from_unix_timestamp | fromUnixTimestamp | (x) | Converts seconds since the Unix epoch to a DateTime. |
from_unix_timestamp64_micro | fromUnixTimestamp64Micro | (x) | Converts microseconds since the Unix epoch to a timestamp. |
from_unix_timestamp64_milli | fromUnixTimestamp64Milli | (x) | Converts milliseconds since the Unix epoch to a timestamp. |
from_unix_timestamp64_nano | fromUnixTimestamp64Nano | (x) | Converts nanoseconds since the Unix epoch to a timestamp. |
gcd | (x, y) | Returns the greatest common divisor of two integers. | |
greatest | (x1, x2, ...) | Returns the largest of its arguments. | |
half_md5 | halfMD5 | (x) | Returns the first 8 bytes of the MD5 hash of a string as a 64-bit number. |
has | (x, y) | Returns 1 when an array contains a value or a map contains a key, and 0 otherwise. | |
hex | (x) | Returns the hexadecimal text form of a value. | |
hive_hash | hiveHash | (x) | Returns the Hive hash of a value. |
host_name | hostName | () | Returns the host name of the server. |
hypot | (x, y) | Returns the length of the hypotenuse of a right triangle with the given sides. | |
if_null | ifNull | (x, y) | Returns the second argument when the first is NULL, and the first otherwise. |
int_div | intDiv | (x, y) | Divides two numbers and rounds the result towards zero to an integer. |
int_div_or_zero | intDivOrZero | (x, y) | Divides two numbers and rounds towards zero, or returns zero when the divisor is zero. |
int_exp10 | intExp10 | (x) | Returns 10 raised to an integer power as an integer. |
int_exp2 | intExp2 | (x) | Returns 2 raised to an integer power as an integer. |
int_hash32 | intHash32 | (x) | Returns a 32-bit hash of an integer. |
int_hash64 | intHash64 | (x) | Returns a 64-bit hash of an integer. |
ipv4_num_to_string | IPv4NumToString, INET_NTOA | (x) | Converts an IPv4 address from a number to dotted text. |
ipv4_num_to_string_class_c | IPv4NumToStringClassC | (x) | Converts an IPv4 address from a number to dotted text with the last byte replaced by xxx. |
ipv4_string_to_num | IPv4StringToNum, INET_ATON | (x) | Converts an IPv4 address from dotted text to a number. |
ipv4_string_to_num_or_default | IPv4StringToNumOrDefault | (x) | Converts an IPv4 address from dotted text to a number, or returns zero when the text is not an address. |
ipv4_string_to_num_or_null | IPv4StringToNumOrNull | (x) | Converts an IPv4 address from dotted text to a number, or returns NULL when the text is not an address. |
is_finite | isFinite | (x) | Returns 1 when a number is neither infinite nor NaN and 0 otherwise. |
is_infinite | isInfinite | (x) | Returns 1 when a number is infinite and 0 otherwise. |
is_ipv4_string | isIPv4String | (x) | Returns 1 when a string is a valid IPv4 address and 0 otherwise. |
is_ipv6_string | isIPv6String | (x) | Returns 1 when a string is a valid IPv6 address and 0 otherwise. |
is_nan | isNaN | (x) | Returns 1 when a number is NaN and 0 otherwise. |
is_not_null | isNotNull | (x) | Returns 0 when the value is NULL and 1 otherwise. |
is_null | isNull | (x) | Returns 1 when the value is NULL and 0 otherwise. |
is_valid_json | isValidJSON | (x) | Returns 1 when a string is valid JSON and 0 otherwise. |
java_hash | javaHash | (x) | Returns the Java hashCode of a value. |
json_extract_array_raw | JSONExtractArrayRaw | (x1, x2, ...) | Returns the elements of the JSON array at the given path as an array of raw JSON text. |
json_extract_bool | JSONExtractBool | (x1, x2, ...) | Returns the value at the given path of a JSON string as a Boolean. |
json_extract_float | JSONExtractFloat | (x1, x2, ...) | Returns the value at the given path of a JSON string as a float. |
json_extract_int | JSONExtractInt | (x1, x2, ...) | Returns the value at the given path of a JSON string as a signed integer. |
json_extract_keys | JSONExtractKeys | (x1, x2, ...) | Returns the keys of the JSON object at the given path as an array. |
json_extract_raw | JSONExtractRaw | (x1, x2, ...) | Returns the value at the given path of a JSON string as raw JSON text. |
json_extract_string | JSONExtractString | (x1, x2, ...) | Returns the value at the given path of a JSON string as a string. |
json_extract_uint | JSONExtractUInt | (x1, x2, ...) | Returns the value at the given path of a JSON string as an unsigned integer. |
json_has | JSONHas | (x1, x2, ...) | Returns 1 when a JSON string has the value at the given path and 0 otherwise. |
json_length | JSONLength | (x1, x2, ...) | Returns the number of elements of the JSON array or object at the given path. |
json_type | JSONType | (x1, x2, ...) | Returns the JSON type of the value at the given path as text. |
l1_distance | L1Distance | (x, y) | Returns the Manhattan distance between two vectors. |
l1_norm | L1Norm | (x) | Returns the sum of the absolute values of a vector. |
l2_distance | l2Distance | (x, y) | Returns the Euclidean distance between two vectors. |
l2_norm | L2Norm | (x) | Returns the Euclidean length of a vector. |
l2_squared_distance | L2SquaredDistance | (x, y) | Returns the squared Euclidean distance between two vectors. |
l2_squared_norm | L2SquaredNorm | (x) | Returns the squared Euclidean length of a vector. |
lcm | (x, y) | Returns the least common multiple of two integers. | |
least | (x1, x2, ...) | Returns the smallest of its arguments. | |
left | (x, y) | Returns the first given number of bytes of a string. | |
left_pad | leftPad, lpad | (x1, x2, ...) | Pads a string on the left to the given length, with spaces or a given fill string. |
left_pad_utf8 | leftPadUTF8 | (x1, x2, ...) | Pads a UTF-8 string on the left to the given length in code points. |
left_utf8 | leftUTF8 | (x, y) | Returns the first given number of code points of a UTF-8 string. |
length | cardinality | (x) | Returns the length of a string in bytes, or the number of elements of an array or map. Returns UInt64. |
length_utf8 | lengthUTF8, char_length, character_length | (x) | Returns the length of a string in Unicode code points. |
lgamma | (x) | Returns the natural logarithm of the absolute value of the gamma function. | |
linf_distance | LinfDistance | (x, y) | Returns the largest absolute difference between the elements of two vectors. |
linf_norm | LinfNorm | (x) | Returns the largest absolute value in a vector. |
llm_classify | llmClassify | (x1, x2, ...) | Asks the configured language model to pick one of the given labels for a text. |
llm_embed | llmEmbed | (x[, y]) | Asks the configured language model for the embedding vector of a text. |
llm_summarize | llmSummarize | (x[, y]) | Asks the configured language model for a summary of the texts of a group. |
log | ln | (x) | Returns the natural logarithm of a number. |
log10 | (x) | Returns the base 10 logarithm of a number. | |
log2 | (x) | Returns the base 2 logarithm of a number. | |
lower | lcase | (x) | Converts ASCII letters of a string to lower case. |
lower_utf8 | lowerUTF8 | (x) | Converts the letters of a UTF-8 string to lower case. |
lp_norm | LpNorm | (x, y) | Returns the p-norm of a vector for the exponent given as the second argument. |
map_concat | mapConcat | (map1, map2, ...) | Merges maps into one map. |
map_from_arrays | mapFromArrays | (x, y) | Builds a map from an array of keys and an array of values. |
map_keys | mapKeys | (x) | Returns the keys of a map as an array. |
map_values | mapValues | (x) | Returns the values of a map as an array. |
mask_hash | (x, y) | Replaces a value with a short hash of the value and a salt, so equal values stay equal. | |
mask_null | (x) | Replaces a value with NULL. Data policies use it to hide a column. | |
mask_partial | (x) | Replaces all but the last four bytes of a string with asterisks. Strings of four bytes or less are masked completely. | |
mask_redact | (x) | Replaces a value with a fixed value of the same type: three asterisks for text, zero for numbers and the epoch for times. | |
match | REGEXP_MATCHES | (x, y) | Returns 1 when a string matches a regular expression anywhere and 0 otherwise. |
md5 | (x) | Returns the MD5 hash of a string. | |
modulo | mod | (x, y) | Returns the remainder of a division. |
modulo_or_zero | moduloOrZero | (x, y) | Returns the remainder of a division, or zero when the divisor is zero. |
negate | (x) | Returns a number with its sign reversed. | |
netloc | (x) | Returns the network location of a URL: user information, host and port. | |
normalize_l2 | normalizeL2, L2Normalize | (x) | Scales a vector to Euclidean length 1. |
not_empty | notEmpty | (x) | Returns 1 when a string or array is not empty and 0 otherwise. |
null_if | nullIf | (x, y) | Returns NULL when the two arguments are equal, and the first argument otherwise. |
path | (x) | Returns the path of a URL without the query string. | |
path_full | pathFull | (x) | Returns the path of a URL with the query string and fragment. |
pi | () | Returns the number pi. | |
port | (x[, y]) | Returns the port of a URL, or a default given as the optional second argument. | |
position | (x1, x2, ...) | Returns the 1-based position of a substring in a string, or 0 when it is not found. | |
position_case_insensitive | positionCaseInsensitive | (x1, x2, ...) | Returns the 1-based position of a substring in a string, ignoring case, or 0 when it is not found. |
positive_modulo | positiveModulo, pmod | (x, y) | Returns the remainder of a division, always zero or positive for a positive divisor. |
pow | power | (x, y) | Raises the first argument to the power of the second. |
protocol | (x) | Returns the scheme of a URL, such as https. | |
query_string | queryString | (x) | Returns the query string of a URL without the leading question mark. |
query_string_and_fragment | queryStringAndFragment | (x) | Returns the query string and the fragment of a URL. |
radians | (x) | Converts an angle from degrees to radians. | |
range | (x1, x2, ...) | Returns an array of integers from a start up to but not including an end, with an optional step. | |
regexp_extract | regexpExtract | (x1, x2, ...) | Returns a capture group of the first match of a regular expression, chosen by an optional group number. |
regexp_quote_meta | regexpQuoteMeta | (x) | Escapes the characters of a string that have a special meaning in a regular expression. |
repeat | (x, y) | Repeats a string the given number of times. | |
replace_all | replaceAll, replace | (x1, x2, ...) | Replaces every occurrence of a substring. |
replace_one | replaceOne | (x1, x2, ...) | Replaces the first occurrence of a substring. |
replace_regexp_all | replaceRegexpAll, REGEXP_REPLACE | (x1, x2, ...) | Replaces every match of a regular expression. |
replace_regexp_one | replaceRegexpOne | (x1, x2, ...) | Replaces the first match of a regular expression. |
reverse | (x) | Reverses the bytes of a string or the elements of an array. | |
reverse_utf8 | reverseUTF8 | (x) | Reverses the code points of a UTF-8 string. |
revision | () | Returns the ClickHouse protocol revision number the server reports. Returns UInt32. | |
right | (x, y) | Returns the last given number of bytes of a string. | |
right_pad | rightPad, rpad | (x1, x2, ...) | Pads a string on the right to the given length, with spaces or a given fill string. |
right_pad_utf8 | rightPadUTF8 | (x1, x2, ...) | Pads a UTF-8 string on the right to the given length in code points. |
right_utf8 | rightUTF8 | (x, y) | Returns the last given number of code points of a UTF-8 string. |
round | (x[, y]) | Rounds a number to the number of decimal places given as the optional second argument. | |
round_age | roundAge | (x) | Returns the lower bound of the age bucket (0, 17, 18, 25, 35, 45 or 55) that holds an age in years. |
round_bankers | roundBankers | (x[, y]) | Rounds a number half to even, to the number of decimal places given as the optional second argument. |
round_duration | roundDuration | (x) | Returns the lower bound, in seconds, of the duration bucket that holds a duration in seconds. |
round_to_exp2 | roundToExp2 | (x) | Rounds a number down to the nearest power of two. |
sha1 | (x) | Returns the SHA-1 hash of a string. | |
sha224 | (x) | Returns the SHA-224 hash of a string. | |
sha256 | (x) | Returns the SHA-256 hash of a string. | |
sha512 | (x) | Returns the SHA-512 hash of a string. | |
sign | (x) | Returns -1, 0 or 1 for a negative, zero or positive number. | |
simple_json_extract_bool | simpleJSONExtractBool, visitParamExtractBool | (x, y) | Returns a field of a JSON string as a Boolean. It does a fast text search and does not fully parse the JSON. |
simple_json_extract_float | simpleJSONExtractFloat, visitParamExtractFloat | (x, y) | Returns a field of a JSON string as a float. It does a fast text search and does not fully parse the JSON. |
simple_json_extract_int | simpleJSONExtractInt, visitParamExtractInt | (x, y) | Returns a field of a JSON string as a signed integer. It does a fast text search and does not fully parse the JSON. |
simple_json_extract_raw | simpleJSONExtractRaw, visitParamExtractRaw | (x, y) | Returns a field of a JSON string as a raw JSON text. It does a fast text search and does not fully parse the JSON. |
simple_json_extract_string | simpleJSONExtractString, visitParamExtractString | (x, y) | Returns a field of a JSON string as a string. It does a fast text search and does not fully parse the JSON. |
simple_json_extract_uint | simpleJSONExtractUInt, visitParamExtractUInt | (x, y) | Returns a field of a JSON string as a unsigned integer. It does a fast text search and does not fully parse the JSON. |
simple_json_has | simpleJSONHas, visitParamHas | (x, y) | Returns 1 when a JSON string has the given field and 0 otherwise. |
sin | (x) | Returns the sine of a number. | |
sinh | (x) | Returns the hyperbolic sine of a number. | |
sip_hash64 | sipHash64 | (x) | Returns the SipHash 64-bit hash of a value. |
space | (x) | Returns a string of the given number of spaces. | |
split_by_char | splitByChar | (x1, x2, ...) | Splits a string at a single separator character into an array. |
split_by_non_alpha | splitByNonAlpha | (x[, y]) | Splits a string at characters that are not letters or digits into an array. |
split_by_string | splitByString | (x1, x2, ...) | Splits a string at a separator string into an array. |
split_by_whitespace | splitByWhitespace | (x[, y]) | Splits a string at runs of whitespace into an array. |
sqrt | (x) | Returns the square root of a number. | |
starts_with | startsWith | (x, y) | Returns 1 when a string starts with the given prefix and 0 otherwise. |
string_array | stringArray | (x1, x2, ...) | Builds an array of strings from its arguments. |
substring | substr, mid | (x1, x2, ...) | Returns part of a string, given a start position and an optional length counted in bytes. |
substring_index | substringIndex, SUBSTRING_INDEX | (x1, x2, ...) | Returns the part of a string before the given number of occurrences of a delimiter. |
substring_utf8 | substringUTF8, substrUTF8 | (x1, x2, ...) | Returns part of a UTF-8 string, given a start position and an optional length counted in code points. |
subtract_days | subtractDays | (x, y) | Subtracts a number of days from a date or timestamp. |
subtract_hours | subtractHours | (x, y) | Subtracts a number of hours from a date or timestamp. |
subtract_minutes | subtractMinutes | (x, y) | Subtracts a number of minutes from a date or timestamp. |
subtract_months | subtractMonths | (x, y) | Subtracts a number of months from a date or timestamp. |
subtract_quarters | subtractQuarters | (x, y) | Subtracts a number of quarters from a date or timestamp. |
subtract_seconds | subtractSeconds | (x, y) | Subtracts a number of seconds from a date or timestamp. |
subtract_weeks | subtractWeeks | (x, y) | Subtracts a number of weeks from a date or timestamp. |
subtract_years | subtractYears | (x, y) | Subtracts a number of years from a date or timestamp. |
tan | (x) | Returns the tangent of a number. | |
tanh | (x) | Returns the hyperbolic tangent of a number. | |
tgamma | (x) | Returns the gamma function of a number. | |
timezone | timeZone | () | Returns the time zone name, which is always UTC. |
to_bool | toBool | (x) | Converts a value to Bool. |
to_date | toDate | (x) | Converts a string, number or timestamp to a Date. |
to_date_or_null | toDateOrNull | (x) | Converts a value to a Date, or returns NULL when it cannot be converted. |
to_date_time | toDateTime | (x) | Converts a string, number or timestamp to a DateTime with second precision. |
to_date_time64 | toDateTime64 | (x[, y]) | Converts a value to a timestamp rounded down to the number of decimal places given as the second argument. |
to_date_time_or_null | toDateTimeOrNull | (x) | Converts a value to a DateTime, or returns NULL when it cannot be converted. |
to_day_of_month | toDayOfMonth | (x) | Returns the day of the month of a date or timestamp. |
to_day_of_week | toDayOfWeek | (x[, y]) | Returns the day of the week of a date or timestamp, with Monday as 1. The optional second argument selects the week mode. |
to_day_of_year | toDayOfYear | (x) | Returns the day of the year of a date or timestamp. |
to_decimal32 | toDecimal32 | (x[, y]) | Converts a value to a Decimal32 with the scale given as the second argument. |
to_decimal32_or_null | toDecimal32OrNull | (x[, y]) | Converts a value to a Decimal32, or returns NULL when it cannot be converted. |
to_decimal32_or_zero | toDecimal32OrZero | (x[, y]) | Converts a value to a Decimal32, or returns zero when it cannot be converted. |
to_decimal64 | toDecimal64 | (x[, y]) | Converts a value to a Decimal64 with the scale given as the second argument. |
to_decimal64_or_null | toDecimal64OrNull | (x[, y]) | Converts a value to a Decimal64, or returns NULL when it cannot be converted. |
to_decimal64_or_zero | toDecimal64OrZero | (x[, y]) | Converts a value to a Decimal64, or returns zero when it cannot be converted. |
to_float32 | toFloat32 | (x) | Converts a value to Float32. |
to_float32_or_null | toFloat32OrNull | (x) | Converts a value to Float32, or returns NULL when it cannot be converted. |
to_float32_or_zero | toFloat32OrZero | (x) | Converts a value to Float32, or returns zero when it cannot be converted. |
to_float64 | toFloat64 | (x) | Converts a value to Float64. |
to_float64_or_null | toFloat64OrNull | (x) | Converts a value to Float64, or returns NULL when it cannot be converted. |
to_float64_or_zero | toFloat64OrZero | (x) | Converts a value to Float64, or returns zero when it cannot be converted. |
to_hour | toHour | (x) | Returns the hour of a date or timestamp. |
to_int16 | toInt16 | (x) | Converts a value to Int16. |
to_int16_or_null | toInt16OrNull | (x) | Converts a value to Int16, or returns NULL when it cannot be converted. |
to_int16_or_zero | toInt16OrZero | (x) | Converts a value to Int16, or returns zero when it cannot be converted. |
to_int32 | toInt32 | (x) | Converts a value to Int32. |
to_int32_or_null | toInt32OrNull | (x) | Converts a value to Int32, or returns NULL when it cannot be converted. |
to_int32_or_zero | toInt32OrZero | (x) | Converts a value to Int32, or returns zero when it cannot be converted. |
to_int64 | toInt64 | (x) | Converts a value to Int64. |
to_int64_or_null | toInt64OrNull | (x) | Converts a value to Int64, or returns NULL when it cannot be converted. |
to_int64_or_zero | toInt64OrZero | (x) | Converts a value to Int64, or returns zero when it cannot be converted. |
to_int8 | toInt8 | (x) | Converts a value to Int8. |
to_int8_or_null | toInt8OrNull | (x) | Converts a value to Int8, or returns NULL when it cannot be converted. |
to_int8_or_zero | toInt8OrZero | (x) | Converts a value to Int8, or returns zero when it cannot be converted. |
to_ipv4 | toIPv4 | (x) | Converts dotted text or a number to an IPv4 value. |
to_iso_week | toISOWeek | (x) | Returns the ISO week number of a date or timestamp. |
to_iso_year | toISOYear | (x) | Returns the ISO year of a date or timestamp. |
to_minute | toMinute | (x) | Returns the minute of a date or timestamp. |
to_monday | toMonday | (x) | Rounds a date or timestamp down to the Monday of its week. |
to_month | toMonth | (x) | Returns the month of a date or timestamp. |
to_quarter | toQuarter | (x) | Returns the quarter of a date or timestamp. |
to_relative_day_num | toRelativeDayNum | (x) | Returns the number of days since the Unix epoch for a date or timestamp. |
to_second | toSecond | (x) | Returns the second of a date or timestamp. |
to_start_of_day | toStartOfDay | (x) | Rounds a date or timestamp down to the start of its day. |
to_start_of_fifteen_minutes | toStartOfFifteenMinutes | (x) | Rounds a date or timestamp down to the start of its fifteen-minute interval. |
to_start_of_five_minutes | toStartOfFiveMinutes, toStartOfFiveMinute | (x) | Rounds a date or timestamp down to the start of its five-minute interval. |
to_start_of_hour | toStartOfHour | (x) | Rounds a date or timestamp down to the start of its hour. |
to_start_of_interval | toStartOfInterval | (x, INTERVAL n unit) | Rounds a timestamp down to the start of an interval written as INTERVAL n unit. |
to_start_of_minute | toStartOfMinute | (x) | Rounds a date or timestamp down to the start of its minute. |
to_start_of_month | toStartOfMonth | (x) | Rounds a date or timestamp down to the start of its month. |
to_start_of_quarter | toStartOfQuarter | (x) | Rounds a date or timestamp down to the start of its quarter. |
to_start_of_ten_minutes | toStartOfTenMinutes | (x) | Rounds a date or timestamp down to the start of its ten-minute interval. |
to_start_of_week | toStartOfWeek | (x[, y]) | Rounds a date or timestamp down to the start of its week. The optional second argument selects the week mode. |
to_start_of_year | toStartOfYear | (x) | Rounds a date or timestamp down to the start of its year. |
to_string | toString | (x) | Converts a value to its text form. |
to_type_name | toTypeName | (x) | Returns the name of the type of a value as text. |
to_uint16 | toUInt16 | (x) | Converts a value to UInt16. |
to_uint16_or_null | toUInt16OrNull | (x) | Converts a value to UInt16, or returns NULL when it cannot be converted. |
to_uint16_or_zero | toUInt16OrZero | (x) | Converts a value to UInt16, or returns zero when it cannot be converted. |
to_uint32 | toUInt32 | (x) | Converts a value to UInt32. Returns UInt32. |
to_uint32_or_null | toUInt32OrNull | (x) | Converts a value to UInt32, or returns NULL when it cannot be converted. Returns UInt32. |
to_uint32_or_zero | toUInt32OrZero | (x) | Converts a value to UInt32, or returns zero when it cannot be converted. Returns UInt32. |
to_uint64 | toUInt64 | (x) | Converts a value to UInt64. Returns UInt64. |
to_uint64_or_null | toUInt64OrNull | (x) | Converts a value to UInt64, or returns NULL when it cannot be converted. Returns UInt64. |
to_uint64_or_zero | toUInt64OrZero | (x) | Converts a value to UInt64, or returns zero when it cannot be converted. Returns UInt64. |
to_uint8 | toUInt8 | (x) | Converts a value to UInt8. |
to_uint8_or_null | toUInt8OrNull | (x) | Converts a value to UInt8, or returns NULL when it cannot be converted. |
to_uint8_or_zero | toUInt8OrZero | (x) | Converts a value to UInt8, or returns zero when it cannot be converted. |
to_unix_timestamp | toUnixTimestamp | (x) | Returns a date or timestamp as seconds since the Unix epoch. |
to_week | toWeek, week | (x[, y]) | Returns the week number of a date or timestamp. The optional second argument selects the week mode. |
to_year | toYear | (x) | Returns the year of a date or timestamp. |
to_year_week | toYearWeek, yearweek | (x[, y]) | Returns the year and week number of a date or timestamp as one number. The optional second argument selects the week mode. |
to_yyyymm | toYYYYMM | (x) | Returns the year and month of a date or timestamp as a number such as 202610. |
to_yyyymmdd | toYYYYMMDD | (x) | Returns the date of a date or timestamp as a number such as 20261031. |
to_yyyymmddhhmmss | toYYYYMMDDhhmmss | (x) | Returns the date and time of a date or timestamp as a number such as 20261031235959. |
top_level_domain | topLevelDomain | (x) | Returns the top-level domain of a URL, such as com. |
translate | (x1, x2, ...) | Replaces each character found in the second argument with the character at the same position in the third; characters with no counterpart are removed. | |
trim_both | trimBoth, trim | (x[, y]) | Removes leading and trailing spaces, or the characters given as the optional second argument. |
trim_left | trimLeft, ltrim | (x[, y]) | Removes leading spaces, or the leading characters given as the optional second argument. |
trim_right | trimRight, rtrim | (x[, y]) | Removes trailing spaces, or the trailing characters given as the optional second argument. |
trunc | truncate | (x[, y]) | Rounds a number towards zero to the number of decimal places given as the optional second argument. |
unbin | (x) | Converts binary text to the bytes it encodes. | |
unhex | (x) | Converts hexadecimal text to the bytes it encodes. | |
upper | ucase | (x) | Converts ASCII letters of a string to upper case. |
upper_utf8 | upperUTF8 | (x) | Converts the letters of a UTF-8 string to upper case. |
version | () | Returns the server version as text, in the form ClickHouse clients expect. | |
wy_hash64 | wyHash64 | (x) | Returns the wyHash 64-bit hash of a value. |
xx_hash32 | xxHash32 | (x) | Returns the xxHash 32-bit hash of a value. |
xx_hash64 | xxHash64 | (x) | Returns the xxHash 64-bit hash of a value. |