Skip to main content
Mirror pipelines use Flink SQL 1.19. The following tables list the built‑in functions available in this SQL dialect. For full usage details see the Flink documentation.

Aggregate functions

  • ANY_VALUE: Returns an arbitrary expression value from each group
  • APPROX_COUNT_DISTINCT: Approximates the number of distinct input values
  • ARRAY_AGG: Aggregates values into an array
  • AVG: Computes the average value
  • BIT_AND: Computes bitwise AND across numeric values
  • BIT_OR: Computes bitwise OR across numeric values
  • BIT_XOR: Computes bitwise XOR across numeric values
  • BOOL_AND: True if all boolean inputs are TRUE
  • BOOL_OR: True if any boolean input is TRUE
  • COLLECT: Aggregates values into a multiset
  • COLLECT_LIST: Aggregates values into a list preserving duplicates
  • COLLECT_SET: Aggregates values into a set of distinct entries
  • COUNT: Counts the number of input rows
  • COVAR_POP: Population covariance
  • COVAR_SAMP: Sample covariance
  • CUME_DIST: Cumulative distribution value
  • DENSE_RANK: Calculates rank without gaps
  • FIRST_VALUE: Returns the first value in an ordered group
  • GROUPING: Indicates if a column is aggregated
  • KURTOSIS: Kurtosis of a numeric distribution
  • LAST_VALUE: Returns the last value in an ordered group
  • MAX: Maximum value
  • MIN: Minimum value
  • PERCENTILE_CONT: Continuous percentile of numeric values
  • PERCENTILE_DISC: Discrete percentile of numeric values
  • RANK: Calculates rank with gaps
  • STDDEV: Sample standard deviation
  • STDDEV_POP: Population standard deviation
  • STDDEV_SAMP: Sample standard deviation
  • SUM: Sum of numeric values
  • VAR_POP: Population variance
  • VAR_SAMP: Sample variance
  • VARIANCE: Alias for sample variance

Collection functions

  • ARRAY: Constructs an array from the given elements
  • ARRAY_APPEND: Appends an element to an array
  • ARRAY_CONCAT: Concatenates two arrays
  • ARRAY_DISTINCT: Removes duplicate elements from an array
  • ARRAY_EXCEPT: Elements of first array not in second
  • ARRAY_LENGTH: Returns the length of an array
  • ARRAY_MAX: Maximum element of an array
  • ARRAY_MIN: Minimum element of an array
  • ARRAY_POSITION: Position of an element in an array
  • ARRAY_PREPEND: Prepends an element to an array
  • ARRAY_REMOVE: Removes all occurrences of an element from an array
  • ARRAY_REPEAT: Creates an array filled with repetitions of an element
  • ARRAY_SLICE: Sub-array defined by start and end
  • ARRAY_SORT: Sorts the elements of an array
  • ARRAY_UNION: Union of two arrays
  • CARDINALITY: Number of elements in a collection
  • ELEMENT: Returns the element from a single-element collection
  • MAP: Constructs a map from key/value pairs
  • MAP_FROM_ARRAYS: Creates a map from two arrays
  • MAP_KEYS: Returns an array of map keys
  • MAP_VALUES: Returns an array of map values
  • MULTISET: Constructs a multiset
  • SLICE: Returns a portion of an array or string

Conditional functions

  • COALESCE: Returns the first non-null argument
  • DECODE: Compares a value against a set of cases
  • IF: Returns one value if condition true else another
  • IFNULL: Returns second argument if first is NULL
  • IFF: Synonym for IF
  • ISFALSE: TRUE if expression is FALSE
  • ISNOTFALSE: TRUE if expression is not FALSE
  • ISNOTTRUE: TRUE if expression is not TRUE
  • ISTRUE: TRUE if expression is TRUE
  • LEAST: Returns the smallest of the arguments
  • GREATEST: Returns the largest of the arguments
  • NULLIF: Returns NULL if arguments are equal
  • NVL: Synonym for IFNULL
  • NVL2: Chooses between two values depending on NULL status

Date and time functions

  • ADDDATE: Adds days to a date
  • ADD_MONTHS: Adds months to a date
  • CURRENT_DATE: Current date
  • CURRENT_TIME: Current time
  • CURRENT_TIMESTAMP: Current timestamp
  • CURRENT_ROW_TIMESTAMP: Timestamp of the current row event time
  • CURDATE: Synonym for CURRENT_DATE
  • CURTIME: Synonym for CURRENT_TIME
  • DATEADD: Adds an interval to a date or timestamp
  • DATEDIFF: Difference between two dates
  • DATE_FORMAT: Formats date/time as string
  • DATE_PART: Extracts part of a date/time
  • DATE_SUB: Subtracts days from a date
  • DAYNAME: Name of the weekday
  • DAYOFMONTH: Day of month (1-31)
  • DAYOFWEEK: Day of week (1-7)
  • DAYOFYEAR: Day of year (1-366)
  • EXTRACT: Extracts fields from date/time
  • FROM_UNIXTIME: Converts UNIX timestamp to timestamp
  • HOUR: Extracts hour field
  • LAST_DAY: Last day of the month
  • LOCALTIME: Current local time
  • LOCALTIMESTAMP: Current local timestamp
  • MAKEDATE: Creates a date from year and day of year
  • MAKETIME: Creates a time from hour, minute, second
  • MINUTE: Extracts minute field
  • MONTH: Extracts month field
  • MONTHNAME: Name of the month
  • NEXT_DAY: Next weekday after a date
  • NOW: Current timestamp
  • QUARTER: Quarter of the year
  • SECOND: Extracts second field
  • TIMESTAMPADD: Adds interval to timestamp
  • TIMESTAMPDIFF: Difference between timestamps
  • TO_DATE: Converts string to date
  • TO_TIMESTAMP: Converts string or numeric to timestamp
  • TO_TIMESTAMP_LTZ: Converts numeric to timestamp with local time zone
  • TO_UNIXTIME: Converts timestamp to UNIX time
  • UNIX_DATE: Number of days since UNIX epoch
  • UNIX_MICROS: Number of microseconds since UNIX epoch
  • UNIX_MILLIS: Number of milliseconds since UNIX epoch
  • UNIX_SECONDS: Number of seconds since UNIX epoch
  • UNIX_TIMESTAMP: UNIX time of a timestamp or now
  • WEEK: Week number of year
  • WEEKDAY: Weekday index (0=Monday)
  • YEAR: Year field of date
  • YEARWEEK: Year and week number

Hash functions

  • MD5: MD5 hash of a string
  • SHA1: SHA‑1 hash of a string
  • SHA224: SHA‑224 hash of a string
  • SHA256: SHA‑256 hash of a string
  • SHA384: SHA‑384 hash of a string
  • SHA512: SHA‑512 hash of a string

JSON functions

  • JSON_ARRAY: Creates a JSON array
  • JSON_EXISTS: Checks for existence of JSON path
  • JSON_OBJECT: Creates a JSON object
  • JSON_QUERY: Extracts JSON fragment
  • JSON_STRING: Converts value to JSON string
  • JSON_VALUE: Extracts a scalar JSON value

Math functions

  • ABS: Absolute value
  • ACOS: Arc cosine
  • ASIN: Arc sine
  • ATAN: Arc tangent
  • ATAN2: Arc tangent of two numbers
  • CBRT: Cube root
  • CEIL: Smallest integer not less than argument
  • COS: Cosine
  • COSH: Hyperbolic cosine
  • COT: Cotangent
  • DEGREES: Converts radians to degrees
  • EXP: Exponential function
  • FLOOR: Largest integer not greater than argument
  • LN: Natural logarithm
  • LOG: Logarithm with arbitrary base
  • LOG10: Base‑10 logarithm
  • LOG2: Base‑2 logarithm
  • MOD: Remainder of division
  • PI: Mathematical constant pi
  • POW: Raises a number to a power
  • POWER: Raises a number to a power
  • RADIANS: Converts degrees to radians
  • RAND: Random number
  • ROUND: Rounds to nearest integer or decimal
  • SIGN: Sign of the number
  • SIN: Sine
  • SINH: Hyperbolic sine
  • SQRT: Square root
  • TAN: Tangent
  • TANH: Hyperbolic tangent

String functions

  • ASCII: ASCII code of the first character
  • BASE64_DECODE: Decodes a base64 string
  • BASE64_ENCODE: Encodes data to base64
  • BTRIM: Trims characters from both ends
  • CHAR: Character for ASCII code
  • CHAR_LENGTH: Number of characters in string
  • CHARACTER_LENGTH: Number of characters in string
  • CHR: Character for Unicode code point
  • CONCAT: Concatenates strings
  • CONCAT_WS: Concatenates strings with separator
  • INITCAP: Converts to title case
  • LEFT: Leftmost characters
  • LENGTH: Length of string in characters
  • LOWER: Converts to lowercase
  • LPAD: Left‑pads a string
  • LTRIM: Trims leading characters
  • OVERLAY: Replaces substring with new text
  • POSITION: Position of substring
  • REGEXP_EXTRACT: Extracts substring by regular expression
  • REGEXP_REPLACE: Replaces substring by regular expression
  • REPEAT: Repeats the string
  • REPLACE: Replaces occurrences of substring
  • REVERSE: Reverses the string
  • RIGHT: Rightmost characters
  • RPAD: Right‑pads a string
  • RTRIM: Trims trailing characters
  • SPLIT: Splits string into array
  • SPLIT_INDEX: Gets element by index after splitting
  • STR_TO_MAP: Converts string to map
  • SUBSTR: Extracts substring
  • SUBSTRING: Extracts substring
  • TO_BASE64: Encodes to base64
  • TO_CHAR: Converts number or timestamp to string
  • TO_HEX: Converts value to hexadecimal
  • TRIM: Trims leading and trailing characters
  • UPPER: Converts to uppercase

Type conversion functions

  • BIN: Converts number to binary string
  • CAST: Converts a value to a different type
  • CONVERT: Converts a value to a different type
  • HEX: Converts number to hexadecimal string
  • TRY_CAST: Attempts to cast and returns NULL if it fails
  • UUID: Generates a random UUID

Window functions

  • HOP_END: End timestamp of a hopping window
  • HOP_START: Start timestamp of a hopping window
  • SESSION_END: End timestamp of a session window
  • SESSION_START: Start timestamp of a session window
  • TUMBLE_END: End timestamp of a tumbling window
  • TUMBLE_START: Start timestamp of a tumbling window
  • WINDOW_END: End timestamp of a generic window
  • WINDOW_START: Start timestamp of a generic window

Other functions

  • CURRENT_CATALOG: Name of the current catalog
  • CURRENT_DATABASE: Name of the current database
  • CURRENT_SCHEMA: Name of the current schema
  • CURRENT_USER: Name of the current user
  • DATABASE: Synonym for CURRENT_DATABASE
  • SESSION_USER: Name of the session user
  • SYSTEM_USER: Name of the system user
  • VERSION: Returns the Flink version