A continuous query (CQ) is used to perform computing on the real-time data of a streaming data table in the Lindorm streaming engine, and then write the computing results to another streaming data table or an external table. When you use a CQ for data computing, you can filter, transform, optimize, and aggregate your streaming data. When you terminate the CQ, the computing process stops. This topic describes the syntax that you can use to create a CQ.
Syntax
CREATE CQ cqName INSERT INTO tableName querySpecification
querySpecification
: SELECT setQuantifier selectItem (',' selectItem)*
(FROM relation (',' relation)*)
(WINDOW windowExpression)
(WHERE where=booleanExpression)
(GROUP BY groupBy)
;Parameters
| Parameter | Required | Description |
|---|---|---|
| cqName | Yes | The name of the CQ. |
| tableName | Yes | The name of the streaming data table or the external table to which the computing result is written. |
| querySpecification | Yes | For information about parameters in the SELECT statement, see SELECT. |
Examples
CREATE CQ GetErrors
INSERT INTO ErrorStream
SELECT log4j
FROM Log4ErrorWarningStream log4j WHERE log4j.level = 'ERROR';