Skip to main content

Views and Functions

Manage view dialects and catalog functions.

See Procedures for Flink version requirements, argument conventions, and catalog selection.

alter_view_dialect

To alter view dialect. Arguments:

  • view: the target view identifier. Cannot be empty.

  • action: define change action like: add, update, drop. Cannot be empty.

  • engine: when engine which is not flink need define it.

  • query: query for the dialect when action is add and update it couldn't be empty.

Syntax

-- add dialect in the view
CALL [catalog.]sys.alter_view_dialect('view_identifier', 'add', 'flink', 'query');

CALL [catalog.]sys.alter_view_dialect(`view` => 'view_identifier', `action` => 'add', `query` => 'query');

-- update dialect in the view
CALL [catalog.]sys.alter_view_dialect('view_identifier', 'update', 'flink', 'query');

CALL [catalog.]sys.alter_view_dialect(`view` => 'view_identifier', `action` => 'update', `query` => 'query');

-- drop dialect in the view
CALL [catalog.]sys.alter_view_dialect('view_identifier', 'drop', 'flink');

CALL [catalog.]sys.alter_view_dialect(`view` => 'view_identifier', `action` => 'drop');

Example

-- add dialect in the view
CALL sys.alter_view_dialect('view_identifier', 'add', 'flink', 'query');

CALL sys.alter_view_dialect(`view` => 'view_identifier', `action` => 'add', `query` => 'query');

-- update dialect in the view
CALL sys.alter_view_dialect('view_identifier', 'update', 'flink', 'query');

CALL sys.alter_view_dialect(`view` => 'view_identifier', `action` => 'update', `query` => 'query');

-- drop dialect in the view
CALL sys.alter_view_dialect('view_identifier', 'drop', 'flink');

CALL sys.alter_view_dialect(`view` => 'view_identifier', `action` => 'drop');

create_function

To create a function. Arguments:

  • function: the target function identifier. Cannot be empty.

  • inputParams: inputParams of the function.

  • returnParams: returnParams of the function.

  • deterministic: Whether the function is deterministic.

  • comment: The comment for the function.

  • options: the additional dynamic options of the function.

Syntax

CALL [catalog.]sys.create_function(
'function_identifier',
'[{"id": 0, "name":"length", "type":"INT"}, {"id": 1, "name":"width", "type":"INT"}]',
'[{"id": 0, "name":"area", "type":"BIGINT"}]',
true, 'comment', 'k1=v1,k2=v2');

Example

CALL sys.create_function(`function` => 'function_identifier',
inputParams => '[{"id": 0, "name":"length", "type":"INT"}, {"id": 1, "name":"width", "type":"INT"}]',
returnParams => '[{"id": 0, "name":"area", "type":"BIGINT"}]',
deterministic => true,
comment => 'comment',
options => 'k1=v1,k2=v2'
);

alter_function

To alter a function. Arguments:

  • function: the target function identifier. Cannot be empty.

  • change: change of the function.

Syntax

CALL [catalog.]sys.alter_function(
'function_identifier',
'{"action" : "addDefinition", "name" : "flink", "definition" : {"type" : "file", "fileResources" : [{"resourceType": "JAR", "uri": "oss://mybucket/xxxx.jar"}], "language": "JAVA", "className": "xxxx", "functionName": "functionName" } }');

Example

CALL sys.alter_function(`function` => 'function_identifier',
`change` => '{"action" : "addDefinition", "name" : "flink", "definition" : {"type" : "file", "fileResources" : [{"resourceType": "JAR", "uri": "oss://mybucket/xxxx.jar"}], "language": "JAVA", "className": "xxxx", "functionName": "functionName" } }'
);

drop_function

To drop a function. Arguments:

  • function: the target function identifier. Cannot be empty.

Syntax

CALL [catalog.]sys.drop_function('function_identifier');

Example

CALL sys.drop_function(`function` => 'function_identifier');