abs
Returns the absolute value of x.
Examples:
examples.sql
acos
Returns the arc cosine of x.
Examples:
examples.sql
array_agg
Returns an array created from the input x elements.
Examples:
examples.sql
array_distinct
Remove duplicate values from the array x.
Examples:
examples.sql
array_except
Returns an array of elements in x but not in y, without duplicates.
Examples:
examples.sql
array_intersect
Returns an array of the elements in the intersection of x and y, without duplicates.
Examples:
examples.sql
array_join
Concatenates the elements of the given array using the delimiter. Null elements are omitted in the result.
Examples:
examples.sql
array_max
Returns the maximum value of input array.
Supported Signatures
array_min
Returns the minimum value of input array.
Supported Signatures
array_position
Returns the position of the first occurrence of the element in array x (or 0 if not found).
Examples:
examples.sql
array_remove
Remove all elements that equal element from array x.
Examples:
examples.sql
array_sort
Sorts and returns the array x. The elements of x must be orderable. Null elements will be placed at the end of the returned array.
Supported Signatures
array_union
Returns an array of the elements in the union of x and y, without duplicates.
Examples:
examples.sql
asin
Returns the arc sine of x.
Examples:
examples.sql
atan
Returns the arc tangent of x.
Examples:
examples.sql
atan2
Returns the arc tangent of y / x.
Examples:
examples.sql
avg
Returns the average (arithmetic mean) of all input values.
Examples:
examples.sql
cardinality
Returns the cardinality (size) of the array x.
Examples:
examples.sql
cbrt
Returns the cube root of x.
Examples:
examples.sql
ceil
This is an alias for ceiling().
Examples:
examples.sql
ceiling
Returns x rounded up to the nearest integer.
Supported Signatures
chr
Returns the Unicode code point n as a single character string.
Examples:
examples.sql
coalesce
Returns the first non-null value in the argument list. Like a CASE expression, arguments are only evaluated if necessary.
Examples:
examples.sql
codepoint
Returns the Unicode code point of the only character of string
.
Examples:
examples.sql
concat
Returns the concatenation of string1, string2, …, stringN. This function provides the same functionality as the SQL-standard concatenation operator (||).
Examples:
examples.sql
concat_ws
Using the first array string0
element as separator, returns the concatenation of all subsequent strings string1, string2, … If `string0“ is null, then the return value is null. Any null values provided in the arguments after the separator are skipped.
Examples:
examples.sql
contains
Takes an array and an element. Returns true if the array contains the element, false if not.
Examples:
examples.sql
cos
Returns the cosine of x.
Examples:
examples.sql
cosh
Returns the hyperbolic cosine of the given value.
Examples:
examples.sql
count
Returns the number of input rows.
Examples:
examples.sql
cume_dist
Returns the cumulative distribution of a value in a group of values. The result is the number of rows preceding or peer with the row in the window ordering of the window partition divided by the total number of rows in the window partition. Thus, any tie values in the ordering will evaluate to the same distribution value.
Supported Signatures
current_date
Returns the current date as of the start of the query.
Examples:
examples.sql
current_time
Returns the current time with time zone as of the start of the query.
Examples:
examples.sql
current_timestamp
Returns the current timestamp with time zone as of the start of the query, with 3 digits of subsecond precision,
Examples:
examples.sql
date
This is an alias for CAST(x AS date).
Supported Signatures
date_diff
Takes a unit, timestamp1, and timestamp2. Returns timestamp2 - timestamp1 expressed in terms of unit.
Examples:
examples.sql
date_format
Formats timestamp as a string using format.
Examples:
examples.sql
date_parse
Parses string into a timestamp using format.
Supported Signatures
date_part
Supported Signatures
date_trunc
Returns x truncated to unit.
Supported Signatures
day
Returns the day of the month from x.
Examples:
examples.sql
day_of_month
This is an alias for day().
Supported Signatures
day_of_week
Returns the ISO day of the week from x. The value ranges from 1 (Monday) to 7 (Sunday).
Supported Signatures
day_of_year
Returns the day of the year from x. The value ranges from 1 to 366.
Supported Signatures
degrees
Converts angle x in radians to degrees.
Examples:
examples.sql
dense_rank
Returns the rank of a value in a group of values. This is similar to rank(), except that tie values do not produce gaps in the sequence.
Examples:
examples.sql
dow
This is an alias for day_of_week().
Supported Signatures
doy
This is an alias for day_of_year().
Supported Signatures
element_at
Returns element of array at given index. If index > 0, this function provides the same functionality as the SQL-standard subscript operator ([]), except that the function returns NULL when accessing an index larger than array length, whereas the subscript operator would fail in such a case. If index < 0, element_at accesses elements from the last to the first.
Supported Signatures
exp
Returns Euler’s number raised to the power of x.
Examples:
examples.sql
first_value
Returns the first value of the window.
Supported Signatures
flatten
Flattens an array(array(T)) to an array(T) by concatenating the contained arrays.
Examples:
examples.sql
floor
Returns x rounded down to the nearest integer.
Supported Signatures
from_unixtime
Returns the UNIX timestamp unixtime as a timestamp with time zone. unixtime is the number of seconds since 1970-01-01 00.00.00 UTC.
Examples:
examples.sql
greatest
Returns the largest of the provided values.
Examples:
examples.sql
grouping
Supported Signatures
hour
Returns the hour of the day from x. The value ranges from 0 to 23.
Supported Signatures
if
Evaluates expression parameter and returns second if condition is true, otherwise null is returned and true_value is not evaluated.
Examples:
examples.sql
index
Alias for strpos() function.
Examples:
examples.sql
is_nan
Determine if x
is not-a-number.
Examples:
examples.sql
lag
Returns the value at offset rows before the current row in the window partition. Offsets start at 0, which is the current row. The offset can be any scalar expression. The default offset is 1. If the offset is null, an error is raised. If the offset refers to a row that is not within the partition, the default_value is returned, or if it is not specified null is returned. The lag() function requires that the window ordering be specified. Window frame must not be specified.
Examples:
examples.sql
last_value
Returns the last value of the window.
Supported Signatures
lead
Returns the value at offset rows after the current row in the window partition. Offsets start at 0, which is the current row. The offset can be any scalar expression. The default offset is 1. If the offset is null, an error is raised. If the offset refers to a row that is not within the partition, the default_value is returned, or if it is not specified null is returned. The lead() function requires that the window ordering be specified. Window frame must not be specified.
Examples:
examples.sql
least
Returns the smallest of the provided values.
Examples:
examples.sql
length
Returns the length of string in characters.
Examples:
examples.sql
levenshtein_distance
Returns the Levenshtein edit distance of string1 and string2, i.e. the minimum number of single-character edits (insertions, deletions or substitutions) needed to change string1 into string2.
Supported Signatures
ln
Returns the natural logarithm of x.
Examples:
examples.sql
localtimestamp
Returns the current timestamp as of the start of the query, with 3 digits of subsecond precision.
Supported Signatures
log
Returns the base b logarithm of x.
Examples:
examples.sql
log10
Returns the base 10 logarithm of x.
Examples:
examples.sql
log2
Returns the base 2 logarithm of x.
Examples:
examples.sql
lower
Converts string to lowercase.
Examples:
examples.sql
lpad
Left pads string to size characters with padstring. If size is less than the length of string, the result is truncated to size characters. size must not be negative and padstring must be non-empty.
Examples:
examples.sql
ltrim
Removes leading whitespace from string.
Examples:
examples.sql
max
Returns the maximum value of all input values.
Examples:
examples.sql
millisecond
Returns the millisecond of the second from x.
Supported Signatures
min
Returns the minimum value of all input values.
Examples:
examples.sql
minute
Returns the minute of the hour from x.
Supported Signatures
mod
Returns the modulus (remainder) of n divided by m.
Supported Signatures
month
Returns the month of the year from x.
Examples:
examples.sql
now
This is an alias for current_timestamp.
Examples:
examples.sql
nth_value
Returns the value at the specified offset from the beginning of the window. Offsets start at 1. The offset can be any scalar expression. If the offset is null or greater than the number of values in the window, null is returned. It is an error for the offset to be zero or negative.
Supported Signatures
ntile
Divides the rows for each window partition into n buckets ranging from 1 to at most n. Bucket values will differ by at most 1. If the number of rows in the partition does not divide evenly into the number of buckets, then the remainder values are distributed one per bucket, starting with the first bucket.
Examples:
examples.sql
nullif
Returns null if value1 equals value2, otherwise returns value1.
Examples:
examples.sql
percent_rank
Returns the percentage ranking of a value in group of values. The result is (r - 1) / (n - 1) where r is the rank() of the row and n is the total number of rows in the window partition.
Examples:
examples.sql
pi
Returns the constant Pi.
Examples:
examples.sql
pow
This is an alias for power().
Supported Signatures
power
Returns x raised to the power of p.
Examples:
examples.sql
quarter
Returns the quarter of the year from x. The value ranges from 1 to 4.
Supported Signatures
radians
Converts angle x in degrees to radians.
Examples:
examples.sql
rand
This is an alias for random().
Supported Signatures
random
Returns a pseudo-random value in the range 0.0 <= x < 1.0.
Examples:
examples.sql
rank
Returns the rank of a value in a group of values. The rank is one plus the number of rows preceding the row that are not peer with the row. Thus, tie values in the ordering will produce gaps in the sequence. The ranking is performed for each window partition.
Examples:
examples.sql
regexp_count
Returns the number of occurrence of pattern in string.
Supported Signatures
regexp_extract
Returns the first substring matched in a string by the regular expression pattern.
Examples:
examples.sql
regexp_extract_all
Returns the substrings of a string matched by the regular expression pattern.
Supported Signatures
regexp_like
Evaluates the regular expression pattern and determines if it is contained within string.
Examples:
examples.sql
regexp_position
Returns the index of the first occurrence (counting from 1) of pattern in string. Returns -1 if not found.
Supported Signatures
regexp_replace
Removes every instance of the substring matched by the regular expression pattern from string.
Examples:
examples.sql
regexp_split
Splits string using the regular expression pattern and returns an array. Trailing empty strings are preserved.
Supported Signatures
repeat
Repeat element for count times.
Examples:
examples.sql
replace
Removes all instances of search from string.
Examples:
examples.sql
reverse
Returns string with the characters in reverse order.
Examples:
examples.sql
round
Returns x rounded to the nearest integer.
Examples:
examples.sql
row_number
Returns a unique, sequential number for each row, starting with one, according to the ordering of rows within the window partition.
Examples:
examples.sql
rpad
Right pads string to size characters with padstring. If size is less than the length of string, the result is truncated to size characters. size must not be negative and padstring must be non-empty.
Examples:
examples.sql
rtrim
Removes trailing whitespace from string.
Examples:
examples.sql
second
Returns the second of the minute from x.
Supported Signatures
sha256
Computes the SHA256 hash of binary.
Examples:
examples.sql
sha512
Computes the SHA512 hash of binary.
Examples:
examples.sql
sign
Returns the signum function of x, that is.
Supported Signatures
sin
Returns the sine of x.
Examples:
examples.sql
sinh
Returns the hyperbolic sine of x.
Examples:
examples.sql
split
Splits string on delimiter and returns an array.
Examples:
examples.sql
split_part
Splits string on delimiter and returns the field index. Field indexes start with 1. If the index is larger than the number of fields, then null is returned.
Examples:
examples.sql
sqrt
Returns the square root of x.
Examples:
examples.sql
starts_with
Tests whether substring is a prefix of string.
Examples:
examples.sql
stddev
This is an alias for stddev_samp().
Supported Signatures
stddev_pop
Returns the population standard deviation of all input values.
Examples:
examples.sql
stddev_samp
Returns the sample standard deviation of all input values.
Examples:
examples.sql
strpos
Returns the starting position of the first instance of substring in string. Positions start with 1. If not found, 0 is returned.
Examples:
examples.sql
substr
This is an alias for substring().
Examples:
examples.sql
substring
Returns the rest of string from the starting position start. Positions start with 1. A negative starting position is interpreted as being relative to the end of the string.
Examples:
examples.sql
sum
Returns the sum of all input values.
Examples:
examples.sql
tan
Returns the tangent of x.
Examples:
examples.sql
tanh
Returns the hyperbolic tangent of x.
Examples:
examples.sql
to_hex
Encodes binary into a hex string representation.
Examples:
examples.sql
to_timestamp_seconds
Supported Signatures
to_unixtime
Returns timestamp as a UNIX timestamp.
Examples:
examples.sql
translate
Returns the source string translated by replacing characters found in the from string with the corresponding characters in the to string. If the from string contains duplicates, only the first is used. If the source character does not exist in the from string, the source character will be copied without translation. If the index of the matching character in the from string is beyond the length of the to string, the source character will be omitted from the resulting string.
Examples:
examples.sql
trim
Removes any leading and/or trailing characters as specified up to and including string from source.
Examples:
examples.sql
truncate
Returns x rounded to integer by dropping digits after decimal point.
Examples:
examples.sql
upper
Converts string to uppercase.
Examples:
examples.sql
uuid
Returns a pseudo randomly generated UUID (type 4).
Examples:
examples.sql
year
Returns the year from x.
Examples:
examples.sql