ALTER statements are used to modified a registered table/view/function definition in the Catalog.
Flink SQL supports the following ALTER statements for now:
ALTER TABLE
ALTER DATABASE
ALTER FUNCTION
Run an ALTER statement
ALTER statements can be executed with the sqlUpdate() method of the TableEnvironment, or executed in SQL CLI. The sqlUpdate() method returns nothing for a successful ALTER operation, otherwise will throw an exception.
The following examples show how to run an ALTER statement in TableEnvironment and in SQL CLI.
ALTER TABLE
Rename Table
Rename the given table name to another new table name.
Set or Alter Table Properties
Set one or more properties in the specified table. If a particular property is already set in the table, override the old value with the new one.
ALTER DATABASE
Set one or more properties in the specified database. If a particular property is already set in the database, override the old value with the new one.
ALTER FUNCTION
Alter a catalog function with the new identifier which is full classpath for JAVA/SCALA and optional language tag. If a function doesn’t exist in the catalog, an exception is thrown.
TEMPORARY
Alter temporary catalog function that has catalog and database namespaces and overrides catalog functions.
TEMPORARY SYSTEM
Alter temporary system function that has no namespace and overrides built-in functions
IF EXISTS
If the function doesn’t exist, nothing happens.
LANGUAGE JAVA|SCALA
Language tag to instruct flink runtime how to execute the function. Currently only JAVA and SCALA are supported, the default language for a function is JAVA.