Striim 3.9.4 / 3.9.5 documentation

CREATE CQ (query)

CREATE CQ name  
INSERT INTO {
  <output stream name>  | 
  <WActionStore name> [ ( <field name>, ... ) ] 
  }
SELECT [DISTINCT] { { <expression or field name> [ AS <output stream field name> ], ... } 
[ ISTREAM ]
FROM {
  <input stream name> | 
  <cache name> |
  <window name> | 
  <WActionStore name>, ... |
  ITERATOR ( <nested collection name>.<member name> ) 
  }
[ { INNER | CROSS | LEFT | LEFT OUTER | RIGHT | RIGHT OUTER | FULL | FULL OUTER } JOIN ]
[ JUMPING WITHIN <integer> { SECOND | MINUTE | HOUR | DAY } ]
[ ON { <expression> } ]
[ WHERE { <expression> } ]
[ GROUP BY { field name } ]
[ HAVING { <expression> } ]
[ ORDER BY { <expression> } [ ASC | DESC ] ]
[ LIMIT { <expression> } ]
[ LINK SOURCE EVENT ] ;

See Operators and Functions for more information about writing expressions.

  • When a CQ's INSERT INTO clause specifies a stream that does not exit, the stream and its type will be created automatically based on the SELECT statement. For an example, see Parsing the data field of WAEvent.

  • When a CQ's INSERT INTO clause specifies a WActionStore, the optional LINK SOURCE EVENT clause makes the details of the events in the FROM clause available in the WActionStore.

  • When a CQ includes the DISTINCT option, at least one of the components in the FROM clause must be a cache or window.

  • When a CQ's FROM clause includes multiple components, at least one must be a cache or window. See Joins.

  • See Using ITERATOR for information on using that function.

  • When a CQ includes the INNER JOIN option, two and only two components must be specified in the FROM clause.

  • By default, a CQ will update calculated values when events are added to or removed from its input window. If you specify the ISTREAM option, the CQ will update calculated values only when new events are added to the window.

  • See Aggregate functions for information on using GROUP BY.

  • SELECT FROM WActionStore_name is supported only when the WActionStore is persisted. When selecting from a WActionStore, use the JUMPING WITHIN clause to indicate how often to update the query with new WActions. Without the JUMPING WITHIN clause, the query will return the entire result set for the query every time it is run.

  • Queries may be nested by enclosing the subquery in parentheses: SELECT ... FROM (SELECT ... FROM ...) ....

  • When selecting from the output stream of a source, you may use SELECT timeStamp to get the system time in milliseconds (as a long) when the source processed the event. The timeStamp field exists only in the source's output stream and is dropped by any window, CQ, or target using that stream as a source.

See Continuous query (CQ) and Intermediate TQL programming: common patterns for some examples of common query types.