CREATE TRIGGER¶
Syntax:
CREATE TRIGGER ON input_stream FOR EACH ROW
[ WHEN filter ] EXECUTE func_name(params)
Example:
jubaql> CREATE TRIGGER ON ds FOR EACH ROW
EXECUTE printLines(3, label)
Explanation¶
CREATE TRIGGER installs a previously defined trigger function on the given stream, i.e., the function will be called for every item in the stream (or only for items matching a certain condition).
input_streamis the stream to use as input. The data source that this stream is derived from must not yet be in process (or done with processing) when the statement is issued.filteris a filter expression just like the ones that can be used in aWHEREclause of a Spark SQLSELECTstatement. If given, the function will be called only for the items in the input stream matching that condition.func_nameis the name of a function previously defined usingCREATE TRIGGER FUNCTION(see CREATE FUNCTION).paramsis a list of expressions to be used as a parameter for that function.