Value based Filtering
This application demonstrates filter out events based on simple conditions such as number value, range or null type.
define stream TemperatureStream (
sensorId string, temperature double);
@info(name = 'EqualsFilter')
from TemperatureStream[ sensorId == 'A1234']
select *
insert into SenorA1234TemperatureStream;
@info(name = 'RangeFilter')
from TemperatureStream[ temperature > -2 and temperature < 40]
select *
insert into NormalTemperatureStream;
@info(name = 'NullFilter')
from TemperatureStream[ sensorId is null ]
select *
insert into InValidTemperatureStream;
|
Defines |
|
|
|
Filter out events with |
|
|
|
|
|
Filter out events where |
|
|
|
|
|
Filter out events with |
|
Input
Below events are sent to TemperatureStream
,
- [
'A1234'
, 39] - [
'sensor1'
, 35] - [
null
, 43]
Output
After processing, the following events will be arriving at each stream:
SenorA1234TemperatureStream:
['A1234'
, 39] onlyNormalTemperatureStream:
['sensor1'
, 35] onlyInValidTemperatureStream:
[null
, 43] only