Functions glossary
The following is a complete alphabetical list of all Firebolt functions:
Name | Function | Type |
---|---|---|
ABS | Calculates the absolute value of an input value. | Numeric |
APACHE_DATASKETCHES_HLL_BUILD | Creates a new Apache DataSketch HyperLogLog sketch. | DataSketches |
APACHE_DATASKETCHES_HLL_ESTIMATE | Extracts a cardinality estimate of a single Apache DataSketch HyperLogLog sketch. | DataSketches |
APACHE_DATASKETCHES_HLL_MERGE | Merges one or more Apache DataSketch HyperLogLog sketches. | DataSketches |
ARRAY_ANY_MATCH | Returns TRUE if the provided function evaluates to TRUE for any element in an array, and FALSE otherwise. | Lambda |
ARRAY_CONCAT | Combines one or more arrays provided as arguments into a single array. | Array |
ARRAY_CONTAINS | Returns TRUE if a specified argument is present in the array, and FALSE otherwise. | Array |
ARRAY_COUNT | Counts the number of elements in a boolean array for which the function applied to (array[i]) evaluates to TRUE , if a function is provided. If not provided, counts the number of elements in the array that evaluate to TRUE . | Lambda |
ARRAY_DISTINCT | Returns an array containing only the distinct elements of the given array. | Array |
ARRAY_FIRST | Returns the first element in the given array for which the given function returns TRUE . | Lambda |
ARRAY_FLATTEN | Converts a nested array of arrays into a flat array by extracting all the elements from the inner arrays into a single, continuous array. | Array |
ARRAY_TO_STRING | Concatenates the elements of a string array into a single string, using an optional specified delimiter between each element. | Array |
ARRAY_LENGTH | Returns the length, or number of elements, in the given array. | Array |
ARRAY_MAX | Returns the maximum element in an array. | Array |
ARRAY_MIN | Returns the minimum element in an array. | Array |
ARRAY_REVERSE | Returns an array of the same size and type as the original array, with the elements in reverse order. | Array |
ARRAY_REVERSE_SORT | Returns the elements of the input array in descending order. If the argument function is provided, the sorting order is determined by the result of applying the function on each element of the array. | Lambda |
ARRAY_SORT | Returns the elements of the input array in ascending order. If the argument function is provided, the sorting order is determined by the result of applying the function on each element of the array. | Lambda |
ARRAY_SUM | Returns the sum of elements of the input array. | Lambda |
ARRAY_TRANSFORM | Returns an array constructed by applying a lambda function to each element of the input arrays. | Lambda |
AVG | Calculates the average of an expression. | Aggregation |
AVG OVER | Returns the average value within the requested window. | Window |
BIT_AND | Performs a bitwise AND operation on an integer expression. | Aggregation |
BIT_OR | Performs a bitwise OR operation on an integer expression. | Aggregation |
BIT_XOR | Performs a bitwise XOR operation on an integer expression. | Aggregation |
BOOL_AND | Returns TRUE if all NOT NULL values in the input are TRUE . | Aggregation |
BOOL_OR | Returns TRUE if any NOT NULL value in the input is TRUE . | Aggregation |
BTRIM | Removes all occurrences of optionally specified characters from both sides of a source string. If no trim parameter is specified, all occurrences of common whitespace (ASCII Decimal 32) characters from both sides of the specified source string are removed. | String |
CAST | Converts data types into other data types based on the specified parameters. | Conditional & miscellaneous |
HASH_AGG | Calculates a hash value across all rows based on a specified list of arguments. | Aggregation |
CITY_HASH | Takes one or more input parameters of any data type and returns a 64-bit non-cryptographic hash value. Returns NULL if any input value is NULL . | Conditional & miscellaneous |
COALESCE | Checks from left to right for the first NOT NULL argument found for each parameter pair. | Conditional & miscellaneous |
CONCAT or || | Concatenates the input strings listed in the input together without adding a separator between them. | String |
CONVERT_FROM | Converts a binary string encoded in a specified format to sql TEXT using the database’s default encoding. | Binary |
COUNT | Counts the number of rows or the number of NOT NULL values. | Aggregation |
COUNT OVER | Counts the number of values within a specified window. | Window |
CURRENT_ACCOUNT | Returns the current account name. | Session |
CURRENT_DATABASE | Returns the current database name. If no database is set, returns account_db . | Session |
CURRENT_DATE | Returns the current (local) date in the time zone specified in the session’s time_zone setting. | Date & time |
CURRENT_ENGINE | Returns the current engine name. Returns system on the system engine. | Session |
CURRENT_TIMESTAMP | Returns the current (local) timestamp in the time zone specified in the session’s time_zone setting. | Date & time |
DATE_ADD | Calculates a new date or timestamp by adding or subtracting a specified number of time units from an indicated expression. | Date & time |
DATE_DIFF | Calculates the difference between the start and end date based on the specified unit. | Date & time |
DATE_TRUNC | Truncates a date or timestamp value to the selected precision. | Date & time |
DECODE | Decodes binary data from a SQL expression of type TEXT into its original form. | Binary |
DENSE_RANK | Ranks the current row within the specified window, ensuring that there are no gaps in the ranking sequence. | Window |
ENCODE | Encodes binary data from its original form into a SQL expression of type TEXT . | Binary |
EXTRACT | Retrieves the time unit from a date or timestamp value. | Date & time |
GENERATE_SERIES | A table-valued function that generates a sequence of numeric values or dates, starting from start to stop , incremented by a step value. | Conditional & miscellaneous |
GREATEST | Selects the largest value from a list of expressions. | Conditional & miscellaneous |
HASH | Computes a 64-bit non-cryptographic hash for one or more input values, with NULL values always producing the same hash. | Conditional & miscellaneous |
HLL_COUNT_BUILD | Counts the approximate number of unique NOT NULL values and aggregates them into HLL++ sketches represented as the BYTEA data type. | Conditional & miscellaneous |
HLL_COUNT_ESTIMATE | Provides a cardinality estimate of a single HLL++ sketch that was previously built using the aggregate function HLL_COUNT_BUILD. | Conditional & miscellaneous |
HLL_COUNT_MERGE | Merges one or more HLL++ sketches that were previously built using the aggregate function HLL_COUNT_BUILD into a new sketch. | Conditional & miscellaneous |
IFNULL | Compares two expressions. Returns the first expression if it is non-NULL, and otherwise returns the second expression. | Conditional & miscellaneous |
ILIKE | Case insensitive pattern of strings. | String |
INDEX_OF | Returns the index position of the first occurrence of the element in an array, or 0 if not found. | Array |
JSON_EXTRACT | Takes an expression containing a JSON document, a JSON path expression, and an optional path syntax. If the key specified using the JSON path expression exists, JSON_EXTRACT returns the sub JSON document pointed by the given JSON path. Otherwise, returns NULL . | Semi-structured data |
JSON_EXTRACT_ARRAY | Takes an expression containing a JSON document, a JSON path expression, and an optional path syntax. If the key specified using the JSON path expression exists and its value is a JSON array, JSON_EXTRACT_ARRAY returns SQL ARRAY(TEXT) contains all JSON elements as raw text inside the JSON array pointed by the given JSON path. Otherwise, returns NULL . | Semi-structured data |
JSON_VALUE | Takes an expression containing a JSON document, removes the outermost quotes and unescapes the value, and extracts a scalar value as SQL TEXT , or NULL if a non-scalar value is selected. | Semi-structured data |
JSON_VALUE_ARRAY | Takes an expression containing a JSON document and extracts an array of scalar values out of it to SQL ARRAY(TEXT) . | Semi-structured data |
LEAST | Selects the smallest value from a list of expressions. | Conditional & miscellaneous |
LENGTH | Returns the length of an input string. | String |
LIKE | Performs case-sensitive pattern matching of strings. | String |
LIST_OBJECTS | Returns an Amazon S3 object metadata and prefixes from the input URL up to the next forward slash (‘/’). | Conditional & miscellaneous |
LN | Returns the natural logarithm (base e) of a number. | Numeric |
LOCALTIMESTAMP | Returns the current local timestamp in the time zone specified in the session’s time_zone setting. | Date & time |
LOG | Returns the logarithm of a number using a custom base, defaulting to base 10 if no base is provided. | Numeric |
LOWER | Converts the input string to lowercase characters. | String |
LPAD | Pads a string from the left with a specified string until it reaches the specified length. | String |
LTRIM | Removes specified characters from the left side of a source string. If no trim parameter is specified, all occurrences of common whitespace (ASCII Decimal 32) characters from the left side of the specified source string are removed. | String |
MAX | Calculates the maximum value of an expression across all input values. | Aggregation |
MAX_BY | Returns the value of its first argument for the row that contains the maximum value of the second argument. | Aggregation |
MAX OVER | Returns the maximum value within the requested window. | Window |
MAX_BY | Returns the value of the specified input column at the row with the maximum value in the specified value column. | Aggregation |
MIN | Calculates the minimum value of an expression across all input values. | Aggregation |
MIN_BY | Returns the value of its first argument for the row that contains the minimum value of the second argument. | Aggregation |
MIN OVER | Returns the maximum value within the requested window. | Window |
MOD | Calculates the remainder after dividing two values. | Numeric |
NTILE | Divides an ordered set into a number of buckets. | Window |
NULLIF | Compares two expressions. Returns NULL if the expressions are equal. Returns the result of the first if they are not equal. | Conditional & miscellaneous |
OCTET_LENGTH | Calculates the length of the input string in bytes. | String |
PERCENT_RANK | Calculates the relative rank of the current row within the requested window. | Window |
POSITION | Returns the position of the substring found in the string, starting from 1. The returned value is for the first matching value, and not for any subsequent valid matches. In case the substring does not exist, position will return 0. | String |
RANDOM | Returns a pseudo-random unsigned value greater than 0 and less than 1 of type DOUBLE PRECISION . | Numeric |
RANK | Rank the current row within the requested window with gaps. | Window |
READ_CSV | Returns a table with data from specified CSV file. | Conditional & miscellaneous |
READ_PARQUET | Returns a table with data from specified Parquet file. | Conditional & miscellaneous |
REGEXP_LIKE | Checks whether a text pattern matches a regular expression string. Returns 0 if it doesn’t match, or 1 if it matches. | String |
REGEXP_LIKE_ANY | Checks whether a given string matches any regular expression pattern from a specified list of patterns. Returns FALSE if it doesn’t match, or TRUE if it matches. | String |
REGEXP_REPLACE | Matches a pattern in the input string and replaces the first matched portion (from the left) with the specified replacement. | String |
REPLACE | Replaces all occurrences of the given pattern substring within the input expression with a replacement substring. | String |
ROUND | Rounds a value to a specified number of decimal places. | Numeric |
ROW_NUMBER | Calculate a unique, increasing row number for each row within the window. | Window |
RPAD | Adds a specified pad string to the end of the string repetitively up until the length of the resulting string is equivalent to an indicated length. | String |
RTRIM | Removes all occurrences of optionally specified characters from the right side of a source string. If no trim parameter is specified, all occurrences of common whitespace (ASCII Decimal 32) characters from the right side of the specified source string are removed. | String |
SESSION_USER | Returns the name of the user running the current query. | Session |
SPLIT_PART | Divides a string based on a specified delimiter into an array of substrings. The string in the specified index is returned, with 1 being the first index. If the string separator is empty, the input string is returned at index 1. | String |
SQRT | Calculates square root of a value. | Numeric |
STRING_TO_ARRAY | Splits a given string by a given separator and returns the result in an array of strings. | String |
STRPOS | Returns the position of the substring found in the string, starting from 1. The returned value is for the first matching value, and not for any subsequent valid matches. In case the substring does not exist, STRPOS will return 0. | String |
SUBSTRING, SUBSTR | Returns a substring starting at the character indicated by the start index and including the number of characters defined. Character indexing starts at 1. | String |
SUM | Calculates the sum of an expression. | Aggregation |
SUM OVER | Calculate the sum of the values within the requested window. | Window |
TO_TIMESTAMP | Converts a string to timestamp with time zone. | Date & time |
TO_YYYYMM | Extracts year and month from a DATE , TIMESTAMP , or TIMESTAMPTZ value and combines them into an integer beginning with the four-digit year followed by the two-digit month. | Date & time |
TO_YYYYMMDD | Extracts year, month and day from a DATE , TIMESTAMP , or TIMESTAMPTZ value and combines them into an integer beginning with the four-digit year followed by the two-digit month followed by the two-digit day. | Date & time |
TRIM | Removes all specified characters from the start, end, or both sides of a string. By default removes all consecutive occurrences of common whitespace (ASCII character 32) from both ends of a string. | String |
TRY_CAST | Converts data types into other data types based on the specified parameters. Returns a NULL if the conversion cannot be performed. | Conditional & miscellaneous |
UPPER | Converts the input string to uppercase characters. | String |
URL_DECODE | Decodes percent-encoded characters. | String |
URL_ENCODE | Encodes characters that are not unreserved using percent encoding. | String |
VECTOR_COSINE_DISTANCE | Computes the cosine distance of two vectors. | Array |
VECTOR_COSINE_SIMILARITY | Computes the cosine similarity of two vectors. | Array |
VECTOR_EUCLIDEAN_DISTANCE | Computes the euclidean distance of two vectors. | Array |
VECTOR_INNER_PRODUCT | Computes the inner product of two vectors. | Array |
VECTOR_MANHATTAN_DISTANCE | Computes the manhattan distance of two vectors. | Array |
VECTOR_SQUARED_EUCLIDEAN_DISTANCE | Computes the squared euclidean distance of two vectors. | Array |
VERSION | Returns the version number information for the Firebolt engine. | Conditional & miscellaneous |