Flink Table API & SQL provides users with a set of built-in functions for data transformations. This page gives a brief overview of them. If a function that you need is not supported yet, you can implement a user-defined function. If you think that the function is general enough, please open a Jira issue for it with a detailed description.
The scalar functions take zero, one or more values as the input and return a single value as the result.
Comparison functions | Description |
---|---|
Returns TRUE if value1 is equal to value2; returns UNKNOWN if value1 or value2 is NULL. |
|
Returns TRUE if value1 is not equal to value2; returns UNKNOWN if value1 or value2 is NULL. |
|
Returns TRUE if value1 is greater than value2; returns UNKNOWN if value1 or value2 is NULL. |
|
Returns TRUE if value1 is greater than or equal to value2; returns UNKNOWN if value1 or value2 is NULL. |
|
Returns TRUE if value1 is less than value2; returns UNKNOWN if value1 or value2 is NULL. |
|
Returns TRUE if value1 is less than or equal to value2; returns UNKNOWN if value1 or value2 is NULL. |
|
Returns TRUE if value is NULL. |
|
Returns TRUE if value is not NULL. |
|
Returns TRUE if two values are not equal. NULL values are treated as identical here. E.g., |
|
Returns TRUE if two values are equal. NULL values are treated as identical here. E.g., |
|
By default (or with the ASYMMETRIC keyword), returns TRUE if value1 is greater than or equal to value2 and less than or equal to value3. With the SYMMETRIC keyword, returns TRUE if value1 is inclusively between value2 and value3. When either value2 or value3 is NULL, returns FALSE or UNKNOWN. E.g., |
|
By default (or with the ASYMMETRIC keyword), returns TRUE if value1 is less than value2 or greater than value3. With the SYMMETRIC keyword, returns TRUE if value1 is not inclusively between value2 and value3. When either value2 or value3 is NULL, returns TRUE or UNKNOWN. E.g., |
|
Returns TRUE if string1 matches pattern string2; returns UNKNOWN if string1 or string2 is NULL. An escape character can be defined if necessary. Note: The escape character has not been supported yet. |
|
Returns TRUE if string1 does not match pattern string2; returns UNKNOWN if string1 or string2 is NULL. An escape character can be defined if necessary. Note: The escape character has not been supported yet. |
|
Returns TRUE if string1 matches SQL regular expression string2; returns UNKNOWN if string1 or string2 is NULL. An escape character can be defined if necessary. Note: The escape character has not been supported yet. |
|
Returns TRUE if string1 does not match SQL regular expression string2; returns UNKNOWN if string1 or string2 is NULL. An escape character can be defined if necessary. Note: The escape character has not been supported yet. |
|
Returns TRUE if value1 exists in the given list (value2, value3, ...). When (value2, value3, ...). contains NULL, returns TRUE if the element can be found and UNKNOWN otherwise. Always returns UNKNOWN if value1 is NULL. E.g., |
|
Returns TRUE if value1 does not exist in the given list (value2, value3, ...). When (value2, value3, ...). contains NULL, returns FALSE if value1 can be found and UNKNOWN otherwise. Always returns UNKNOWN if value1 is NULL. E.g., |
|
Returns TRUE if sub-query returns at least one row. Only supported if the operation can be rewritten in a join and group operation. Note: For streaming queries the operation is rewritten in a join and group operation. The required state to compute the query result might grow infinitely depending on the number of distinct input rows. Please provide a query configuration with valid retention interval to prevent excessive state size. See Query Configuration for details. |
|
Returns TRUE if value is equal to a row returned by sub-query. Note: For streaming queries the operation is rewritten in a join and group operation. The required state to compute the query result might grow infinitely depending on the number of distinct input rows. Please provide a query configuration with valid retention interval to prevent excessive state size. See Query Configuration for details. |
|
Returns TRUE if value is not equal to every row returned by sub-query. Note: For streaming queries the operation is rewritten in a join and group operation. The required state to compute the query result might grow infinitely depending on the number of distinct input rows. Please provide a query configuration with valid retention interval to prevent excessive state size. See Query Configuration for details. |
Comparison functions | Description |
---|---|
Returns TRUE if ANY1 is equal to ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY1 is not equal to ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY1 is greater than ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY1 is greater than or equal to ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY1 is less than ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY1 is less than or equal to ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY is NULL. |
|
Returns TRUE if ANY is not NULL. |
|
Returns TRUE if STRING1 matches pattern STRING2; returns UNKNOWN if STRING1 or STRING2 is NULL. E.g., |
|
Returns TRUE if STRING1 matches SQL regular expression STRING2; returns UNKNOWN if STRING1 or STRING2 is NULL. E.g., |
|
Returns TRUE if ANY1 exists in a given list (ANY2, ANY3, ...). When (ANY2, ANY3, ...). contains NULL, returns TRUE if the element can be found and UNKNOWN otherwise. Always returns UNKNOWN if ANY1 is NULL. E.g., |
|
Returns TRUE if ANY is equal to a row returned by sub-query TABLE. Note: For streaming queries the operation is rewritten in a join and group operation. The required state to compute the query result might grow infinitely depending on the number of distinct input rows. Please provide a query configuration with valid retention interval to prevent excessive state size. See Query Configuration for details. |
|
Returns TRUE if ANY1 is greater than or equal to ANY2 and less than or equal to ANY3. When either ANY2 or ANY3 is NULL, returns FALSE or UNKNOWN. E.g., |
|
Returns TRUE if ANY1 is less than ANY2 or greater than ANY3. When either ANY2 or ANY3 is NULL, returns TRUE or UNKNOWN. E.g., |
Comparison functions | Description |
---|---|
Returns TRUE if ANY1 is equal to ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY1 is not equal to ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY1 is greater than ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY1 is greater than or equal to ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY1 is less than ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY1 is less than or equal to ANY2; returns UNKNOWN if ANY1 or ANY2 is NULL. |
|
Returns TRUE if ANY is NULL. |
|
Returns TRUE if ANY is not NULL. |
|
Returns TRUE if STRING1 matches pattern STRING2; returns UNKNOWN if STRING1 or STRING2 is NULL. E.g., |
|
Returns TRUE if STRING1 matches SQL regular expression STRING2; returns UNKNOWN if STRING1 or STRING2 is NULL. E.g., |
|
Returns TRUE if ANY1 exists in a given list (ANY2, ANY3, ...). When (ANY2, ANY3, ...). contains NULL, returns TRUE if the element can be found and UNKNOWN otherwise. Always returns UNKNOWN if ANY1 is NULL. E.g., |
|
Returns TRUE if ANY is equal to a row returned by sub-query TABLE. Note: For streaming queries the operation is rewritten in a join and group operation. The required state to compute the query result might grow infinitely depending on the number of distinct input rows. Please provide a query configuration with valid retention interval to prevent excessive state size. See Query Configuration for details. |
|
Returns TRUE if ANY1 is greater than or equal to ANY2 and less than or equal to ANY3. When either ANY2 or ANY3 is NULL, returns FALSE or UNKNOWN. E.g., |
|
Returns TRUE if ANY1 is less than ANY2 or greater than ANY3. When either ANY2 or ANY3 is NULL, returns TRUE or UNKNOWN. E.g., |
Logical functions | Description |
---|---|
Returns TRUE if boolean1 is TRUE or boolean2 is TRUE. Supports three-valued logic. E.g., |
|
Returns TRUE if boolean1 and boolean2 are both TRUE. Supports three-valued logic. E.g., |
|
Returns TRUE if boolean is FALSE; returns FALSE if boolean is TRUE; returns UNKNOWN if boolean is UNKNOWN. |
|
Returns TRUE if boolean is FALSE; returns FALSE if boolean is TRUE or UNKNOWN. |
|
Returns TRUE if boolean is TRUE or UNKNOWN; returns FALSE if boolean is FALSE. |
|
Returns TRUE if boolean is TRUE; returns FALSE if boolean is FALSE or UNKNOWN. |
|
Returns TRUE if boolean is FALSE or UNKNOWN; returns FALSE if boolean is TRUE. |
|
Returns TRUE if boolean is UNKNOWN; returns FALSE if boolean is TRUE or FALSE. |
|
Returns TRUE if boolean is TRUE or FALSE; returns FALSE if boolean is UNKNOWN. |
Logical functions | Description |
---|---|
Returns TRUE if BOOLEAN1 is TRUE or BOOLEAN2 is TRUE. Supports three-valued logic. E.g., |
|
Returns TRUE if BOOLEAN1 and BOOLEAN2 are both TRUE. Supports three-valued logic. E.g., |
|
Returns TRUE if BOOLEAN is FALSE; returns FALSE if BOOLEAN is TRUE; returns UNKNOWN if BOOLEAN is UNKNOWN. |
|
Returns TRUE if BOOLEAN is TRUE; returns FALSE if BOOLEAN is FALSE or UNKNOWN. |
|
Returns TRUE if BOOLEAN is FALSE; returns FALSE if BOOLEAN is TRUE or UNKNOWN. |
|
Returns TRUE if BOOLEAN is FALSE or UNKNOWN; returns FALSE if BOOLEAN is TRUE. |
|
Returns TRUE if BOOLEAN is TRUE or UNKNOWN; returns FALSE if BOOLEAN is FALSE. |
Logical functions | Description |
---|---|
Returns TRUE if BOOLEAN1 is TRUE or BOOLEAN2 is TRUE. Supports three-valued logic. E.g., |
|
Returns TRUE if BOOLEAN1 and BOOLEAN2 are both TRUE. Supports three-valued logic. E.g., |
|
Returns TRUE if BOOLEAN is FALSE; returns FALSE if BOOLEAN is TRUE; returns UNKNOWN if BOOLEAN is UNKNOWN. |
|
Returns TRUE if BOOLEAN is TRUE; returns FALSE if BOOLEAN is FALSE or UNKNOWN. |
|
Returns TRUE if BOOLEAN is FALSE; returns FALSE if BOOLEAN is TRUE or UNKNOWN. |
|
Returns TRUE if BOOLEAN is FALSE or UNKNOWN; returns FALSE if BOOLEAN is TRUE. |
|
Returns TRUE if BOOLEAN is TRUE or UNKNOWN; returns FALSE if BOOLEAN is FALSE. |
Arithmetic functions | Description |
---|---|
Returns numeric. |
|
Returns negative numeric. |
|
Returns numeric1 plus numeric2. |
|
Returns numeric1 minus numeric2. |
|
Returns numeric1 multiplied by numeric2. |
|
Returns numeric1 divided by numeric2. |
|
Returns numeric1 raised to the power of numeric2. |
|
Returns the absolute value of numeric. |
|
Returns the remainder (modulus) of numeric1 divided by numeric2. The result is negative only if numeric1 is negative. |
|
Returns the square root of numeric. |
|
Returns the natural logarithm (base e) of numeric. |
|
Returns the base 10 logarithm of numeric. |
|
Returns the base 2 logarithm of numeric. |
|
When called with one argument, returns the natural logarithm of numeric2. When called with two arguments, this function returns the logarithm of numeric2 to the base numeric1. Note: Currently, numeric2 must be greater than 0 and numeric1 must be greater than 1. |
|
Returns e raised to the power of numeric. |
|
Rounds numeric up, and returns the smallest number that is greater than or equal to numeric. |
|
Rounds numeric down, and returns the largest number that is less than or equal to numeric. |
|
Returns the sine of numeric. |
|
Returns the hyperbolic sine of numeric. The return type is DOUBLE. |
|
Returns the cosine of numeric. |
|
Returns the tangent of numeric. |
|
Returns the hyperbolic tangent of numeric. The return type is DOUBLE. |
|
Returns the cotangent of a numeric. |
|
Returns the arc sine of numeric. |
|
Returns the arc cosine of numeric. |
|
Returns the arc tangent of numeric. |
|
Returns the arc tangent of a coordinate (numeric1, numeric2). |
|
Returns the hyperbolic cosine of NUMERIC. Return value type is DOUBLE. |
|
Returns the degree representation of a radian numeric. |
|
Returns the radian representation of a degree numeric. |
|
Returns the signum of numeric. |
|
Returns a number rounded to integer decimal places for numeric. |
|
Returns a value that is closer than any other values to pi. |
|
Returns a value that is closer than any other values to e. |
|
Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive). |
|
Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive) with an initial seed integer. Two RAND functions will return identical sequences of numbers if they have the same initial seed. |
|
Returns a pseudorandom integer value between 0 (inclusive) and integer (exclusive). |
|
Returns a pseudorandom integer value between 0 (inclusive) and the specified value (exclusive) with an initial seed. Two RAND_INTEGER functions will return identical sequences of numbers if they have the same initial seed and bound. |
|
Returns an UUID (Universally Unique Identifier) string (e.g., "3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 4122 type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo random number generator. |
|
Returns a string representation of integer in binary format. Returns NULL if integer is NULL. E.g. |
|
Returns a string representation of an integer numeric value or a string in hex format. Returns NULL if the argument is NULL. E.g. a numeric 20 leads to "14", a numeric 100 leads to "64", a string "hello,world" leads to "68656C6C6F2C776F726C64". |
|
Returns a numeric of truncated to integer2 decimal places. Returns NULL if numeric1 or integer2 is NULL.If integer2 is 0,the result has no decimal point or fractional part.integer2 can be negative to cause integer2 digits left of the decimal point of the value to become zero.This function can also pass in only one numeric1 parameter and not set Integer2 to use.If Integer2 is not set, the function truncates as if Integer2 were 0. E.g. |
|
Returns the value of π (pi). Only supported in blink planner. |
Arithmetic functions | Description |
---|---|
Returns NUMERIC. |
|
Returns negative NUMERIC. |
|
Returns NUMERIC1 plus NUMERIC2. |
|
Returns NUMERIC1 minus NUMERIC2. |
|
Returns NUMERIC1 multiplied by NUMERIC2. |
|
Returns NUMERIC1 divided by NUMERIC2. |
|
Returns NUMERIC1 raised to the power of NUMERIC2. |
|
Returns the absolute value of NUMERIC. |
|
Returns the remainder (modulus) of NUMERIC1 divided by NUMERIC2. The result is negative only if numeric1 is negative. |
|
Returns the square root of NUMERIC. |
|
Returns the natural logarithm (base e) of NUMERIC. |
|
Returns the base 10 logarithm of NUMERIC. |
|
Returns the base 2 logarithm of NUMERIC. |
|
When called without argument, returns the natural logarithm of NUMERIC1. When called with an argument, returns the logarithm of NUMERIC1 to the base NUMERIC2. Note: Currently, NUMERIC1 must be greater than 0 and NUMERIC2 must be greater than 1. |
|
Returns e raised to the power of NUMERIC. |
|
Rounds NUMERIC up, and returns the smallest number that is greater than or equal to NUMERIC. |
|
Rounds NUMERIC down, and returns the largest number that is less than or equal to NUMERIC. |
|
Returns the sine of NUMERIC. |
|
Returns the hyperbolic sine of NUMERIC. The return type is DOUBLE. |
|
Returns the cosine of NUMERIC. |
|
Returns the tangent of NUMERIC. |
|
Returns the hyperbolic tangent of NUMERIC. The return type is DOUBLE. |
|
Returns the cotangent of a NUMERIC. |
|
Returns the arc sine of NUMERIC. |
|
Returns the arc cosine of NUMERIC. |
|
Returns the arc tangent of NUMERIC. |
|
Returns the arc tangent of a coordinate (NUMERIC1, NUMERIC2). |
|
Returns the hyperbolic cosine of NUMERIC. Return value type is DOUBLE. |
|
Returns the degree representation of a radian NUMERIC. |
|
Returns the radian representation of a degree NUMERIC. |
|
Returns the signum of NUMERIC. |
|
Returns a number rounded to INT decimal places for NUMERIC. |
|
Returns a value that is closer than any other values to pi. |
|
Returns a value that is closer than any other values to e. |
|
Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive). |
|
Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive) with an initial seed INTEGER. Two RAND functions will return identical sequences of numbers if they have the same initial seed. |
|
Returns a pseudorandom integer value between 0 (inclusive) and INTEGER (exclusive). |
|
Returns a pseudorandom integer value between 0 (inclusive) and INTEGER2 (exclusive) with an initial seed INTEGER1. Two randInteger functions will return identical sequences of numbers if they have same initial seed and bound. |
|
Returns an UUID (Universally Unique Identifier) string (e.g., "3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 4122 type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo random number generator. |
|
Returns a string representation of INTEGER in binary format. Returns NULL if INTEGER is NULL. E.g., |
|
Returns a string representation of an integer NUMERIC value or a STRING in hex format. Returns NULL if the argument is NULL. E.g. a numeric 20 leads to "14", a numeric 100 leads to "64", a string "hello,world" leads to "68656C6C6F2C776F726C64". |
|
Returns a numeric of truncated to integer2 decimal places. Returns NULL if numeric1 or integer2 is NULL.If integer2 is 0,the result has no decimal point or fractional part.integer2 can be negative to cause integer2 digits left of the decimal point of the value to become zero.This function can also pass in only one numeric1 parameter and not set Integer2 to use.If Integer2 is not set, the function truncates as if Integer2 were 0. E.g. |
Arithmetic functions | Description |
---|---|
Returns NUMERIC. |
|
Returns negative NUMERIC. |
|
Returns NUMERIC1 plus NUMERIC2. |
|
Returns NUMERIC1 minus NUMERIC2. |
|
Returns NUMERIC1 multiplied by NUMERIC2. |
|
Returns NUMERIC1 divided by NUMERIC2. |
|
Returns NUMERIC1 raised to the power of NUMERIC2. |
|
Returns the absolute value of NUMERIC. |
|
Returns the remainder (modulus) of NUMERIC1 divided by NUMERIC2. The result is negative only if numeric1 is negative. |
|
Returns the square root of NUMERIC. |
|
Returns the natural logarithm (base e) of NUMERIC. |
|
Returns the base 10 logarithm of NUMERIC. |
|
Returns the base 2 logarithm of NUMERIC. |
|
When called without argument, returns the natural logarithm of NUMERIC1. When called with an argument, returns the logarithm of NUMERIC1 to the base NUMERIC2. Note: Currently, NUMERIC1 must be greater than 0 and NUMERIC2 must be greater than 1. |
|
Returns e raised to the power of NUMERIC. |
|
Rounds NUMERIC up, and returns the smallest number that is greater than or equal to NUMERIC. |
|
Rounds NUMERIC down, and returns the largest number that is less than or equal to NUMERIC. |
|
Returns the sine of NUMERIC. |
|
Returns the hyperbolic sine of NUMERIC. The return type is DOUBLE. |
|
Returns the cosine of NUMERIC. |
|
Returns the tangent of NUMERIC. |
|
Returns the hyperbolic tangent of NUMERIC. The return type is DOUBLE. |
|
Returns the cotangent of a NUMERIC. |
|
Returns the arc sine of NUMERIC. |
|
Returns the arc cosine of NUMERIC. |
|
Returns the arc tangent of NUMERIC. |
|
Returns the arc tangent of a coordinate (NUMERIC1, NUMERIC2). |
|
Returns the hyperbolic cosine of NUMERIC. Return value type is DOUBLE. |
|
Returns the degree representation of a radian NUMERIC. |
|
Returns the radian representation of a degree NUMERIC. |
|
Returns the signum of NUMERIC. |
|
Returns a number rounded to INT decimal places for NUMERIC. |
|
Returns a value that is closer than any other values to pi. |
|
Returns a value that is closer than any other values to e. |
|
Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive). |
|
Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive) with an initial seed INTEGER. Two RAND functions will return identical sequences of numbers if they have the same initial seed. |
|
Returns a pseudorandom integer value between 0 (inclusive) and INTEGER (exclusive). |
|
Returns a pseudorandom integer value between 0 (inclusive) and INTEGER2 (exclusive) with an initial seed INTEGER1. Two randInteger functions will return identical sequences of numbers if they have same initial seed and bound. |
|
Returns an UUID (Universally Unique Identifier) string (e.g., "3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 4122 type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo random number generator. |
|
Returns a string representation of INTEGER in binary format. Returns NULL if INTEGER is NULL. E.g., |
|
Returns a string representation of an integer NUMERIC value or a STRING in hex format. Returns NULL if the argument is NULL. E.g. a numeric 20 leads to "14", a numeric 100 leads to "64", a string "hello,world" leads to "68656C6C6F2C776F726C64". |
String functions | Description |
---|---|
Returns the concatenation of string1 and string2. |
|
Returns the number of characters in string. |
|
Returns string in uppercase. |
|
Returns string in lowercase. |
|
Returns the position (start from 1) of the first occurrence of string1 in string2; returns 0 if string1 cannot be found in string2. |
|
Returns a string that removes leading and/or trailing characters string1 from string2. By default, whitespaces at both sides are removed. |
|
Returns a string that removes the left whitespaces from string. E.g., |
|
Returns a string that removes the right whitespaces from string. E.g., |
|
Returns a string that repeats the base string integer times. E.g., |
|
Returns a string from string1 with all the substrings that match a regular expression string2 consecutively being replaced with string3. E.g., |
|
Returns a string that replaces integer2 (string2's length by default) characters of string1 with string2 from position integer1. E.g., |
|
Returns a substring of string starting from position integer1 with length integer2 (to the end by default). |
|
Returns a new string which replaces all the occurrences of string2 with string3 (non-overlapping) from string1 E.g., |
|
Returns a string from string1 which extracted with a specified regular expression string2 and a regex match group index integer. Note: The regex match group index starts from 1 and 0 means matching the whole regex. In addition, the regex match group index should not exceed the number of the defined groups. E.g. |
|
Returns a new form of string with the first character of each word converted to uppercase and the rest characters to lowercase. Here a word means a sequences of alphanumeric characters. |
|
Returns a string that concatenates string1, string2, .... Returns NULL if any argument is NULL. E.g., |
|
Returns a string that concatenates string2, string3, ... with a separator string1. The separator is added between the strings to be concatenated. Returns NULL If string1 is NULL. Compared with E.g., |
|
Returns a new string from string1 left-padded with string2 to a length of integer characters. If the length of string1 is shorter than integer, returns string1 shortened to integer characters. E.g., |
|
Returns a new string from string1 right-padded with string2 to a length of integer characters. If the length of string1 is shorter than integer, returns string1 shortened to integer characters. E.g., |
|
Returns the base64-decoded result from string; returns NULL if string is NULL. E.g., |
|
Returns the base64-encoded result from string; returns NULL if string is NULL. E.g., |
|
Returns the numeric value of the first character of string. Returns NULL if string is NULL. Only supported in blink planner. E.g., |
|
Returns the ASCII character having the binary equivalent to integer. If integer is larger than 255, we will get the modulus of integer divided by 255 first, and returns CHR of the modulus. Returns NULL if integer is NULL. Only supported in blink planner. E.g., |
|
Decodes the first argument into a String using the provided character set (one of 'US-ASCII', 'ISO-8859-1', 'UTF-8', 'UTF-16BE', 'UTF-16LE', 'UTF-16'). If either argument is null, the result will also be null. Only supported in blink planner. |
|
Encodes the string1 into a BINARY using the provided string2 character set (one of 'US-ASCII', 'ISO-8859-1', 'UTF-8', 'UTF-16BE', 'UTF-16LE', 'UTF-16'). If either argument is null, the result will also be null. Only supported in blink planner. |
|
Returns the position of the first occurrence of string2 in string1. Returns NULL if any of arguments is NULL.</p>
Only supported in blink planner. |
|
Returns the leftmost integer characters from the string. Returns EMPTY String if integer is negative. Returns NULL if any argument is NULL. Only supported in blink planner. |
|
Returns the rightmost integer characters from the string. Returns EMPTY String if integer is negative. Returns NULL if any argument is NULL. Only supported in blink planner. |
|
Returns the position of the first occurrence of string1 in string2 after position integer. Returns 0 if not found. Returns NULL if any of arguments is NULL. Only supported in blink planner. |
|
Returns the specified part from the URL. Valid values for string2 include 'HOST', 'PATH', 'QUERY', 'REF', 'PROTOCOL', 'AUTHORITY', 'FILE', and 'USERINFO'. Returns NULL if any of arguments is NULL. E.g., Also a value of a particular key in QUERY can be extracted by providing the key as the third argument string3. E.g., Only supported in blink planner. |
|
Returns TRUE if any (possibly empty) substring of string1 matches the Java regular expression string2, otherwise FALSE. Returns NULL if any of arguments is NULL. Only supported in blink planner. |
|
Returns the reversed string. Returns NULL if string is NULL. Only supported in blink planner. |
|
Splits string1 by the delimiter string2, returns the integerth (zero-based) string of the split strings. Returns NULL if integer is negative. Returns NULL if any of arguments is NULL. Only supported in blink planner. |
|
Returns a map after splitting the string1 into key/value pairs using delimiters. string2 is the pair delimiter, default is ','. And string3 is the key-value delimiter, default is '='. Only supported in blink planner. |
|
Returns a substring of string starting from position integer1 with length integer2 (to the end by default). Only supported in blink planner. |
String functions | Description |
---|---|
Returns the concatenation of STRING1 and STRING2. |
|
Returns the number of characters in STRING. |
|
Returns STRING in uppercase. |
|
Returns STRING in lowercase. |
|
Returns the position (start from 1) of the first occurrence of STRING1 in STRING2; returns 0 if STRING1 cannot be found in STRING2. |
|
Returns a string that removes leading and/or trailing characters STRING2 from STRING1. By default, whitespaces at both sides are removed. |
|
Returns a string that removes the left whitespaces from STRING. E.g., |
|
Returns a string that removes the right whitespaces from STRING. E.g., |
|
Returns a string that repeats the base STRING INT times. E.g., |
|
Returns a string from STRING1 with all the substrings that match a regular expression STRING2 consecutively being replaced with STRING3. E.g., |
|
Returns a string that replaces INT2 (STRING2's length by default) characters of STRING1 with STRING2 from position INT1. E.g., |
|
Returns a substring of STRING starting from position INT1 with length INT2 (to the end by default). |
|
Returns a new string which replaces all the occurrences of STRING2 with STRING3 (non-overlapping) from STRING1. E.g., |
|
Returns a string from STRING1 which extracted with a specified regular expression STRING2 and a regex match group index INTEGER1. Note: The regex match group index starts from 1 and 0 means matching the whole regex. In addition, the regex match group index should not exceed the number of the defined groups. E.g., |
|
Returns a new form of STRING with the first character of each word converted to uppercase and the rest characters to lowercase. Here a word means a sequences of alphanumeric characters. |
|
Returns a string that concatenates STRING1, STRING2, .... Returns NULL if any argument is NULL. E.g., |
|
Returns a string that concatenates STRING2, STRING3, ... with a separator STRING1. The separator is added between the strings to be concatenated. Returns NULL If STRING1 is NULL. Compared with E.g., |
|
Returns a new string from STRING1 left-padded with STRING2 to a length of INT characters. If the length of STRING1 is shorter than INT, returns STRING1 shortened to INT characters. E.g., |
|
Returns a new string from STRING1 right-padded with STRING2 to a length of INT characters. If the length of STRING1 is shorter than INT, returns STRING1 shortened to INT characters. E.g., |
|
Returns the base64-decoded result from STRING; returns NULL if STRING is NULL. E.g., |
|
Returns the base64-encoded result from STRING; returns NULL if STRING is NULL. E.g., |
String functions | Description |
---|---|
Returns the concatenation of STRING1 and STRING2. |
|
Returns the number of characters in STRING. |
|
Returns STRING in uppercase. |
|
Returns STRING in lowercase. |
|
Returns the position (start from 1) of the first occurrence of STRING1 in STRING2; returns 0 if STRING1 cannot be found in STRING2. |
|
Returns a string that removes leading and/or trailing characters from STRING. |
|
Returns a string that removes the left whitespaces from STRING. E.g., |
|
Returns a string that removes the right whitespaces from STRING. E.g., |
|
Returns a string that repeats the base STRING INT times. E.g., |
|
Returns a string from STRING1 with all the substrings that match a regular expression STRING2 consecutively being replaced with STRING3. E.g. |
|
Returns a string that replaces INT2 (STRING2's length by default) characters of STRING1 with STRING2 from position INT1. E.g., |
|
Returns a substring of STRING starting from position INT1 with length INT2 (to the end by default). |
|
Returns a new string which replaces all the occurrences of STRING2 with STRING3 (non-overlapping) from STRING1. E.g., |
|
Returns a string from STRING1 which extracted with a specified regular expression STRING2 and a regex match group index INTEGER1. Note: The regex match group index starts from 1 and 0 means matching the whole regex. In addition, the regex match group index should not exceed the number of the defined groups. E.g. |
|
Returns a new form of STRING with the first character of each word converted to uppercase and the rest characters to lowercase. Here a word means a sequences of alphanumeric characters. |
|
Returns a string that concatenates STRING1, STRING2, .... Returns NULL if any argument is NULL. E.g., |
|
Returns a string that concatenates STRING2, STRING3, ... with a separator STRING1. The separator is added between the strings to be concatenated. Returns NULL If STRING1 is NULL. Compared with E.g., |
|
Returns a new string from STRING1 left-padded with STRING2 to a length of INT characters. If the length of STRING1 is shorter than INT, returns STRING1 shortened to INT characters. E.g., |
|
Returns a new string from STRING1 right-padded with STRING2 to a length of INT characters. If the length of STRING1 is shorter than INT, returns STRING1 shortened to INT characters. E.g., |
|
Returns the base64-decoded result from STRING; returns null If STRING is NULL. E.g., |
|
Returns the base64-encoded result from STRING; returns NULL if STRING is NULL. E.g., |
Temporal functions | Description |
---|---|
Returns a SQL date parsed from string in form of "yyyy-MM-dd". |
|
Returns a SQL time parsed from string in form of "HH:mm:ss". |
|
Returns a SQL timestamp parsed from string in form of "yyyy-MM-dd HH:mm:ss[.SSS]". |
|
Parses an interval string in the form "dd hh:mm:ss.fff" for SQL intervals of milliseconds or "yyyy-mm" for SQL intervals of months. An interval range might be E.g., |
|
Returns the current SQL date in the UTC time zone. |
|
Returns the current SQL time in the UTC time zone. |
|
Returns the current SQL timestamp in the UTC time zone. |
|
Returns the current SQL time in local time zone. |
|
Returns the current SQL timestamp in local time zone. |
|
Returns a long value extracted from the timeintervalunit part of temporal. E.g., |
|
Returns the year from SQL date date. Equivalent to EXTRACT(YEAR FROM date). E.g., |
|
Returns the quarter of a year (an integer between 1 and 4) from SQL date date. Equivalent to E.g., |
|
Returns the month of a year (an integer between 1 and 12) from SQL date date. Equivalent to E.g., |
|
Returns the week of a year (an integer between 1 and 53) from SQL date date. Equivalent to E.g., |
|
Returns the day of a year (an integer between 1 and 366) from SQL date date. Equivalent to E.g., |
|
Returns the day of a month (an integer between 1 and 31) from SQL date date. Equivalent to E.g., |
|
Returns the day of a week (an integer between 1 and 7; Sunday = 1) from SQL date date.Equivalent to E.g., |
|
Returns the hour of a day (an integer between 0 and 23) from SQL timestamp timestamp. Equivalent to E.g., |
|
Returns the minute of an hour (an integer between 0 and 59) from SQL timestamp timestamp. Equivalent to E.g., |
|
Returns the second of a minute (an integer between 0 and 59) from SQL timestamp. Equivalent to E.g., |
|
Returns a value that rounds timepoint down to the time unit timeintervalunit. E.g., |
|
Returns a value that rounds timepoint up to the time unit timeintervalunit. E.g., |
|
Returns TRUE if two time intervals defined by (timepoint1, temporal1) and (timepoint2, temporal2) overlap. The temporal values could be either a time point or a time interval. E.g., |
|
Attention for old planner This function has serious bugs and should not be used for now. Please implement a custom UDF instead or use EXTRACT as a workaround. For blink planner, this converts timestamp to a value of string in the format specified by the date format string. The format string is compatible with Java's SimpleDateFormat. |
|
Returns a new time value that adds a (signed) integer interval to timepoint. The unit for interval is given by the unit argument, which should be one of the following values: E.g., |
|
Returns the (signed) number of timepointunit between timepoint1 and timepoint2. The unit for the interval is given by the first argument, which should be one of the following values: E.g., |
|
Converts a datetime string1 (with default ISO timestamp format 'yyyy-MM-dd HH:mm:ss') from time zone string2 to time zone string3. The format of time zone should be either an abbreviation such as "PST", a full name such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". E.g., Only supported in blink planner. |
|
Returns a representation of the numeric argument as a value in string format (default is 'YYYY-MM-DD hh:mm:ss'). numeric is an internal timestamp value representing seconds since '1970-01-01 00:00:00' UTC, such as produced by the UNIX_TIMESTAMP() function. The return value is expressed in the session time zone (specified in TableConfig). E.g., Only supported in blink planner. |
|
Gets current Unix timestamp in seconds. This function is not deterministic. Only supported in blink planner. |
|
Converts date time string string1 in format string2 (by default: yyyy-MM-dd HH:mm:ss if not specified) to Unix timestamp (in seconds), using the specified timezone in table config. Only supported in blink planner. |
|
Converts a date string string1 with format string2 (by default 'yyyy-MM-dd') to a date. Only supported in blink planner. |
|
Converts date time string string1 with format string2 (by default: 'yyyy-MM-dd HH:mm:ss') under the session time zone (specified by TableConfig) to a timestamp. Only supported in blink planner. |
|
Returns the current SQL timestamp in the UTC time zone. This function is not deterministic. Only supported in blink planner. |
Temporal functions | Description |
---|---|
Returns a SQL date parsed from STRING in form of "yyyy-MM-dd". |
|
Returns a SQL time parsed from STRING in form of "HH:mm:ss". |
|
Returns a SQL timestamp parsed from STRING in form of "yyyy-MM-dd HH:mm:ss[.SSS]". |
|
Creates an interval of months for NUMERIC years. |
|
Creates an interval of months for NUMERIC quarters. E.g., |
|
Creates an interval of NUMERIC months. |
|
Creates an interval of milliseconds for NUMERIC weeks. E.g., |
|
Creates an interval of milliseconds for NUMERIC days. |
|
Creates an interval of milliseconds for NUMERIC hours. |
|
Creates an interval of milliseconds for NUMERIC minutes. |
|
Creates an interval of milliseconds for NUMERIC seconds. |
|
Creates an interval of NUMERIC milliseconds. |
|
Returns the current SQL date in the UTC time zone. |
|
Returns the current SQL time in the UTC time zone. |
|
Returns the current SQL timestamp in the UTC time zone. |
|
Returns the current SQL time in local time zone. |
|
Returns the current SQL timestamp in local time zone. |
|
Returns a long value extracted from the TIMEINTERVALUNIT part of temporal. E.g., |
|
Returns a value that rounds TIMEPOINT down to the time unit TIMEINTERVALUNIT. E.g., |
|
Returns a value that rounds TIMEPOINT up to the time unit TIMEINTERVALUNIT. E.g., |
|
Returns TRUE if two time intervals defined by (TIMEPOINT1, TEMPORAL1) and (TIMEPOINT2, TEMPORAL2) overlap. The temporal values could be either a time point or a time interval. E.g., |
|
Attention This function has serious bugs and should not be used for now. Please implement a custom UDF instead or use extract() as a workaround. |
|
Returns the (signed) number of TIMEPOINTUNIT between TIMEPOINT1 and TIMEPOINT2. The unit for the interval is given by the first argument, which should be one of the following values: E.g., |
Temporal functions | Description |
---|---|
Returns a SQL date parsed from STRING in form of "yyyy-MM-dd". |
|
Returns a SQL time parsed from STRING in form of "HH:mm:ss". |
|
Returns a SQL timestamp parsed from STRING in form of "yyyy-MM-dd HH:mm:ss[.SSS]". |
|
Creates an interval of months for NUMERIC years. |
|
Creates an interval of months for NUMERIC quarters. E.g., |
|
Creates an interval of NUMERIC months. |
|
Creates an interval of milliseconds for NUMERIC weeks. E.g., |
|
Creates an interval of milliseconds for NUMERIC days. |
|
Creates an interval of milliseconds for NUMERIC hours. |
|
Creates an interval of milliseconds for NUMERIC minutes. |
|
Creates an interval of milliseconds for NUMERIC seconds. |
|
Creates an interval of NUMERIC milliseconds. |
|
Returns the current SQL date in the UTC time zone. |
|
Returns the current SQL time in the UTC time zone. |
|
Returns the current SQL timestamp in the UTC time zone. |
|
Returns the current SQL time in local time zone. |
|
Returns the current SQL timestamp in local time zone. |
|
Returns a long value extracted from the TIMEINTERVALUNIT part of temporal. E.g., |
|
Returns a value that rounds TIMEPOINT down to the time unit TIMEINTERVALUNIT. E.g., |
|
Returns a value that rounds TIMEPOINT up to the time unit TIMEINTERVALUNIT. E.g., |
|
Returns TRUE if two time intervals defined by (TIMEPOINT1, TEMPORAL1) and (TIMEPOINT2, TEMPORAL2) overlap. The temporal values could be either a time point or a time interval. E.g., |
|
Attention This function has serious bugs and should not be used for now. Please implement a custom UDF instead or use extract() as a workaround. |
|
Returns the (signed) number of TIMEPOINTUNIT between TIMEPOINT1 and TIMEPOINT2. The unit for the interval is given by the first argument, which should be one of the following values: E.g., |
Conditional functions | Description |
---|---|
Returns resultX when the first time value is contained in (valueX_1, valueX_2, ...). When no value matches, returns resultZ if it is provided and returns NULL otherwise. |
|
Returns resultX when the first conditionX is met. When no condition is met, returns resultZ if it is provided and returns NULL otherwise. |
|
Returns NULL if value1 is equal to value2; returns value1 otherwise. E.g., |
|
Returns the first value that is not NULL from value1, value2, .... E.g., |
|
Returns the true_value if condition is met, otherwise false_value. Only supported in blink planner. E.g., |
|
Returns true if all characters in string are letter, otherwise false. Only supported in blink planner. |
|
Returns true if string can be parsed to a valid numeric, otherwise false. Only supported in blink planner. |
|
Returns true if all characters in string are digit, otherwise false. Only supported in blink planner. |
Conditional functions | Description |
---|---|
Returns VALUE1 if BOOLEAN evaluates to TRUE; returns VALUE2 otherwise. E.g., |
Conditional functions | Description |
---|---|
Returns VALUE1 if BOOLEAN evaluates to TRUE; returns VALUE2 otherwise. E.g., |
Type conversion functions | Description |
---|---|
Returns a new value being cast to type type. See the supported types here. E.g., |
Type conversion functions | Description |
---|---|
Returns a new ANY being cast to type TYPE. See the supported types here. E.g., |
Type conversion functions | Description |
---|---|
Returns a new ANY being cast to type TYPE. See the supported types here. E.g., |
Collection functions | Description |
---|---|
Returns the number of elements in array. |
|
Returns the element at position integer in array. The index starts from 1. |
|
Returns the sole element of array (whose cardinality should be one); returns NULL if array is empty. Throws an exception if array has more than one element. |
|
Returns the number of entries in map. |
|
Returns the value specified by key value in map. |
Collection functions | Description |
---|---|
Returns the number of elements in ARRAY. |
|
Returns the element at position INT in ARRAY. The index starts from 1. |
|
Returns the sole element of ARRAY (whose cardinality should be one); returns NULL if ARRAY is empty. Throws an exception if ARRAY has more than one element. |
|
Returns the number of entries in MAP. |
|
Returns the value specified by key ANY in MAP. |
Collection functions | Description |
---|---|
Returns the number of elements in ARRAY. |
|
Returns the element at position INT in ARRAY. The index starts from 1. |
|
Returns the sole element of ARRAY (whose cardinality should be one); returns NULL if ARRAY is empty. Throws an exception if ARRAY has more than one element. |
|
Returns the number of entries in MAP. |
|
Returns the value specified by key ANY in MAP. |
Value construction functions | Description |
---|---|
Returns a row created from a list of values (value1, value2,...). |
|
Returns an array created from a list of values (value1, value2, ...). |
|
Returns a map created from a list of key-value pairs ((value1, value2), (value3, value4), ...). |
Value constructor functions | Description |
---|---|
Returns a row created from a list of object values (ANY1, ANY2, ...). Row is composite type that can be access via value access functions. |
|
Returns an array created from a list of object values (ANY1, ANY2, ...). |
|
Returns a map created from a list of key-value pairs ((ANY1, ANY2), (ANY3, ANY4), ...). |
|
Creates a NUMERIC interval of rows (commonly used in window creation). |
Value constructor functions | Description |
---|---|
Returns a row created from a list of object values (ANY1, ANY2, ...). Row is composite type that can be access via value access functions. |
|
Returns an array created from a list of object values (ANY1, ANY2, ...). |
|
Returns a map created from a list of key-value pairs ((ANY1, ANY2), (ANY3, ANY4), ...). |
|
Creates a NUMERIC interval of rows (commonly used in window creation). |
Value access functions | Description |
---|---|
Returns the value of a field from a Flink composite type (e.g., Tuple, POJO) by name. |
|
Returns a flat representation of a Flink composite type (e.g., Tuple, POJO) that converts each of its direct subtype into a separate field.
In most cases the fields of the flat representation are named similarly to the original fields but with a dollar separator (e.g., |
Value access functions | Description |
---|---|
Returns the value of a field from a Flink composite type (e.g., Tuple, POJO) by name or index. E.g., |
|
Returns a flat representation of a Flink composite type (e.g., Tuple, POJO) that converts each of its direct subtype into a separate field.
In most cases the fields of the flat representation are named similarly to the original fields but with a dollar separator (e.g., |
Value access functions | Description |
---|---|
Returns the value of a field from a Flink composite type (e.g., Tuple, POJO) by name or index. E.g., |
|
Returns a flat representation of a Flink composite type (e.g., Tuple, POJO) that converts each of its direct subtype into a separate field.
In most cases the fields of the flat representation are named similarly to the original fields but with a dollar separator (e.g., |
Grouping functions | Description |
---|---|
Returns an integer that uniquely identifies the combination of grouping keys. |
|
Returns a bit vector of the given grouping expressions. |
Grouping functions | Description |
---|
Grouping functions | Description |
---|
Hash functions | Description |
---|---|
Returns the MD5 hash of string as a string of 32 hexadecimal digits; returns NULL if string is NULL. |
|
Returns the SHA-1 hash of string as a string of 40 hexadecimal digits; returns NULL if string is NULL. |
|
Returns the SHA-224 hash of string as a string of 56 hexadecimal digits; returns NULL if string is NULL. |
|
Returns the SHA-256 hash of string as a string of 64 hexadecimal digits; returns NULL if string is NULL. |
|
Returns the SHA-384 hash of string as a string of 96 hexadecimal digits; returns NULL if string is NULL. |
|
Returns the SHA-512 hash of string as a string of 128 hexadecimal digits; returns NULL if string is NULL. |
|
Returns the hash using the SHA-2 family of hash functions (SHA-224, SHA-256, SHA-384, or SHA-512). The first argument string is the string to be hashed and the second argument hashLength is the bit length of the result (224, 256, 384, or 512). Returns NULL if string or hashLength is NULL. |
Hash functions | Description |
---|---|
Returns the MD5 hash of STRING as a string of 32 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-1 hash of STRING as a string of 40 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-224 hash of STRING as a string of 56 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-256 hash of STRING as a string of 64 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-384 hash of STRING as a string of 96 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-512 hash of STRING as a string of 128 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-2 family (SHA-224, SHA-256, SHA-384, or SHA-512) hashed value specified by INT (which could be 224, 256, 384, or 512) for STRING. Returns NULL if STRING or INT is NULL. |
Hash functions | Description |
---|---|
Returns the MD5 hash of STRING as a string of 32 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-1 hash of STRING as a string of 40 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-224 hash of STRING as a string of 56 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-256 hash of STRING as a string of 64 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-384 hash of STRING as a string of 96 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-512 hash of STRING as a string of 128 hexadecimal digits; returns NULL if STRING is NULL. |
|
Returns the SHA-2 family (SHA-224, SHA-256, SHA-384, or SHA-512) hashed value specified by INT (which could be 224, 256, 384, or 512) for STRING. Returns NULL if STRING or INT is NULL. |
Auxiliary functions | Description |
---|
Auxiliary functions | Description |
---|---|
Specifies a name for ANY (a field). Additional names can be specified if the expression expands to multiple fields. |
Auxiliary functions | Description |
---|---|
Specifies a name for ANY (a field). Additional names can be specified if the expression expands to multiple fields. |
The aggregate functions take an expression across all the rows as the input and return a single aggregated value as the result.
Aggregate functions | Description |
---|---|
By default or with ALL, returns the number of input rows for which expression is not NULL. Use DISTINCT for one unique instance of each value. |
|
Returns the number of input rows. |
|
By default or with keyword ALL, returns the average (arithmetic mean) of expression across all input rows. Use DISTINCT for one unique instance of each value. |
|
By default or with keyword ALL, returns the sum of expression across all input rows. Use DISTINCT for one unique instance of each value. |
|
By default or with keyword ALL, returns the maximum value of expression across all input rows. Use DISTINCT for one unique instance of each value. |
|
By default or with keyword ALL, returns the minimum value of expression across all input rows. Use DISTINCT for one unique instance of each value. |
|
By default or with keyword ALL, returns the population standard deviation of expression across all input rows. Use DISTINCT for one unique instance of each value. |
|
By default or with keyword ALL, returns the sample standard deviation of expression across all input rows. Use DISTINCT for one unique instance of each value. |
|
By default or with keyword ALL, returns the population variance (square of the population standard deviation) of expression across all input rows. Use DISTINCT for one unique instance of each value. |
|
By default or with keyword ALL, returns the sample variance (square of the sample standard deviation) of expression across all input rows. Use DISTINCT for one unique instance of each value. |
|
By default or with keyword ALL, returns a multiset of expression across all input rows. NULL values will be ignored. Use DISTINCT for one unique instance of each value. |
|
Synonyms for VAR_SAMP(). Only supported in blink planner. |
|
Returns the rank of a value in a group of values. The result is one plus the number of rows preceding or equal to the current row in the ordering of the partition. The values will produce gaps in the sequence. Only supported in blink planner. |
|
Returns the rank of a value in a group of values. The result is one plus the previously assigned rank value. Unlike the function rank, dense_rank will not produce gaps in the ranking sequence. Only supported in blink planner. |
|
Assigns a unique, sequential number to each row, starting with one, according to the ordering of rows within the window partition. ROW_NUMBER and RANK are similar. ROW_NUMBER numbers all rows sequentially (for example 1, 2, 3, 4, 5). RANK provides the same numeric value for ties (for example 1, 2, 2, 4, 5). Only supported in blink planner. |
|
Returns the value of expression at the offsetth row after the current row in the window. The default value of offset is 1 and the default value of default is NULL. Only supported in blink planner. |
|
Returns the value of expression at the offsetth row after the current row in the window. The default value of offset is 1 and the default value of default is NULL. Only supported in blink planner. |
|
Returns the first value in an ordered set of values. Only supported in blink planner. |
|
Returns the last value in an ordered set of values. Only supported in blink planner. |
|
Concatenates the values of string expressions and places separator values between them. The separator is not added at the end of string. The default value of separator is ','. Only supported in blink planner. |
Aggregate functions | Description |
---|---|
Returns the number of input rows for which FIELD is not NULL. |
|
Returns the average (arithmetic mean) of FIELD across all input rows. |
|
Returns the sum of numeric field FIELD across all input rows. If all values are NULL, returns NULL. |
|
Returns the sum of numeric field FIELD across all input rows. If all values are NULL, returns 0. |
|
Returns the maximum value of numeric field FIELD across all input rows. |
|
Returns the minimum value of numeric field FIELD across all input rows. |
|
Returns the population standard deviation of numeric field FIELD across all input rows. |
|
Returns the sample standard deviation of numeric field FIELD across all input rows. |
|
Returns the population variance (square of the population standard deviation) of numeric field FIELD across all input rows. |
|
Returns the sample variance (square of the sample standard deviation) of numeric field FIELD across all input rows. |
|
Returns a multiset of FIELD across all input rows. |
Aggregate functions | Description |
---|---|
Returns the number of input rows for which FIELD is not NULL. |
|
Returns the average (arithmetic mean) of FIELD across all input rows. |
|
Returns the sum of numeric field FIELD across all input rows. If all values are NULL, returns NULL. |
|
Returns the sum of numeric field FIELD across all input rows. If all values are NULL, returns 0. |
|
Returns the maximum value of numeric field FIELD across all input rows. |
|
Returns the minimum value of numeric field FIELD across all input rows. |
|
Returns the population standard deviation of numeric field FIELD across all input rows. |
|
Returns the sample standard deviation of numeric field FIELD across all input rows. |
|
Returns the population variance (square of the population standard deviation) of numeric field FIELD across all input rows. |
|
Returns the sample variance (square of the sample standard deviation) of numeric field FIELD across all input rows. |
|
Returns a multiset of FIELD across all input rows. |
The following table lists specifiers for time interval and time point units.
For Table API, please use _
for spaces (e.g., DAY_TO_HOUR
).
Time Interval Unit | Time Point Unit |
---|---|
MILLENIUM (SQL-only) |
|
CENTURY (SQL-only) |
|
YEAR |
YEAR |
YEAR TO MONTH |
|
QUARTER |
QUARTER |
MONTH |
MONTH |
WEEK |
WEEK |
DAY |
DAY |
DAY TO HOUR |
|
DAY TO MINUTE |
|
DAY TO SECOND |
|
HOUR |
HOUR |
HOUR TO MINUTE |
|
HOUR TO SECOND |
|
MINUTE |
MINUTE |
MINUTE TO SECOND |
|
SECOND |
SECOND |
MILLISECOND |
|
MICROSECOND |
|
DOY (SQL-only) |
|
DOW (SQL-only) |
|
SQL_TSI_YEAR (SQL-only) |
|
SQL_TSI_QUARTER (SQL-only) |
|
SQL_TSI_MONTH (SQL-only) |
|
SQL_TSI_WEEK (SQL-only) |
|
SQL_TSI_DAY (SQL-only) |
|
SQL_TSI_HOUR (SQL-only) |
|
SQL_TSI_MINUTE (SQL-only) |
|
SQL_TSI_SECOND (SQL-only) |
The column functions are used to select or deselect table columns.
SYNTAX | DESC |
---|---|
withColumns(…) | select the specified columns |
withoutColumns(…) | deselect the columns specified |
The detailed syntax is as follows:
The usage of the column function is illustrated in the following table. (Suppose we have a table with 5 columns: (a: Int, b: Long, c: String, d:String, e: String)
):
Api | Usage | Description |
---|---|---|
withColumns(*)|* | all the columns | |
withColumns(m to n) | columns from m to n | |
withColumns(m, n, k) | columns m, n, k | |
withColumns(m, n to k) | mixing of the above two representation | |
withoutColumns(m to n) | deselect columns from m to n | |
withoutColumns(m, n, k) | deselect columns m, n, k | |
withoutColumns(m, n to k) | mixing of the above two representation |
Api | Usage | Description |
---|---|---|
withColumns(*)|* | all the columns | |
withColumns(m to n) | columns from m to n | |
withColumns(m, n, k) | columns m, n, k | |
withColumns(m, n to k) | mixing of the above two representation | |
withoutColumns(m to n) | deselect columns from m to n | |
withoutColumns(m, n, k) | deselect columns m, n, k | |
withoutColumns(m, n to k) | mixing of the above two representation |
The column functions can be used in all places where column fields are expected, such as select, groupBy, orderBy, UDFs etc.
e.g.:
Note Column functions are only used in Table API.