The WHERE clause can be used to specify the joining conditions that apply when multiple event streams are joined or to specify event filtering conditions.
Syntax:
where conditionExpression
The comparison operators =, <, >, >=, <=, !=, <>, IS NULL, and IS NOT NULL, and logical combinations using AND and OR are supported for a WHERE clause conditionExpression.
Note
Notes on using Virtual Data Windows
The WHERE clause, which can be used for accessing information stored in a Virtual Data Window, must contain a condition for uniquely identifying cache entries. This condition uses "=" to perform a comparison with the key property specified using vdw:ehcache(). An example is shown below.
Definition example
In the following example, W.code = T.code is valid, because it uniquely identifies a cache entry.
create window MarketWindow.vdw:ehcache("MARKET", "code") as (code string, high int, low int);
on TicketEvent as T
select W.high, W.low from MarketWindow as W
where W.code = T.code and ( T.price > W.high or T.price < W.low);
The table below shows valid and invalid definition examples of using the above rule to change the WHERE clause only.
No | Definition example | Valid/ | Explanation |
---|---|---|---|
1 | where code = '1111' | Valid | Valid because the condition can uniquely identify a cache entry by using "=" to perform a comparison with the key property |
2 | where ( T.price > W.high or T.price < W.low) and W.code=T.code | Valid | Preceded by a different condition but valid because it includes "=" for performing a comparison with the key property and can uniquely identify a cache entry |
3 | where high = 1000 | Invalid | Invalid because a comparison using "=" is not performed for the key property |
4 | where code > '1111' | Invalid | Invalid because an operation other than "=" is performed for the key property |
5 | where code = '1111' or high = 1000 | Invalid | Includes "=" for performing a comparison with the key property but is invalid because there is an OR condition and a cache entry cannot be uniquely identified |