Functions

    There are two dimensions to classify functions in Flink.

    One dimension is system (or built-in) functions v.s. catalog functions. System functions have no namespace and can be referenced with just their names. Catalog functions belong to a catalog and database therefore they have catalog and database namespaces, they can be referenced by either fully/partially qualified name ( or ) or just the function name.

    The other dimension is temporary functions v.s. persistent functions. Temporary functions are volatile and only live up to lifespan of a session, they are always created by users. Persistent functions live across lifespan of sessions, they are either provided by the system or persisted in catalogs.

    1. Temporary system functions
    2. System functions
    3. Temporary catalog functions
    4. Catalog functions

    There are two ways users can reference a function in Flink - referencing function precisely or ambiguously.

    Precise function reference empowers users to use catalog functions specifically, and across catalog and across database, e.g. and .

    This is only supported starting from Flink 1.10.

    The resolution order only matters when there are functions of different types but the same name, e.g. when there’re three functions all named “myfunc” but are of temporary catalog, catalog, and system function respectively. If there’s no function name collision, functions will just be resolved to the sole one.

    Because system functions don’t have namespaces, a precise function reference in Flink must be pointing to either a temporary catalog function or a catalog function.

    The resolution order is:

    1. Catalog function
    1. Temporary system function
    2. System function
    3. Temporary catalog function, in the current catalog and current database of the session
    4. Catalog function, in the current catalog and current database of the session