Print

Conditional Window

Conditional windows accept values only when certain conditions are met.
For example:

  • Window of “response_time” from POST requests, ignoring GET requests.
  • Window of “bid” on stock TSLA, ignoring all other stocks.
  • Window of “error_code” from production servers, ignoring test servers.

Access Rule

Requires WINDOW, STREAM or ADMIN role.

Syntax

WHEN <expression> 

Scalar Functions are supported in the condition.

Example

CREATE WINDOW last_1000_bids
RUNNING min, max, avg, slope
FROM my_stock_stream.bid
WHEN symbol = 'TSLA'
   OR (symbol LIKE 'SP%' AND symbol != 'SPY')
   OR symbol IN ('LCID','RIVN')
RANGE 1000;
CREATE WINDOW last_1000_bids
RUNNING min, max, avg, slope
FROM my_stock_stream.bid
WHEN UPPER(symbol) like 'T%'
   AND LENGTH(symbol) = 4
RANGE 1000;
Table of Contents
Scroll to Top