Generate Alerts Using a Derived Window in SAP HANA Streaming Analytics
Intermediate
20 min.
Create and use a derived window to analyze events, filter data, and generate alerts.
You will learn
- How to use a derived window to apply a filter to watch for events that should generate an alert
Prerequisites
In this tutorial, you will add and configure a derived stream that will watch for events that need to generate an alert - by applying a filter.
However, rather than just using the standard Filter element, you will use the Derived Window element from the Palette since it gives you more flexibility. With this, you can apply the filter and also change the structure of the output event.
At this point in the tutorial series, if you don’t want to go through the process of creating this window using the visual editor, then you can simply switch to the CCL editor ( F6 ) and paste the CCL below into your project. From there, you can then skip to the last step to compile and test your project.
CREATE OUTPUT WINDOW ALARM_TEMP
PRIMARY KEY DEDUCED
KEEP ALL
AS SELECT
AVG_TEMP.MACHINEID MACHINEID ,
AVG_TEMP.EVENT_TIME EVENT_TIME ,
AVG_TEMP.AVG_TEMP AVG_TEMP ,
AVG_TEMP.MAX_TEMP MAX_TEMP ,
AVG_TEMP.LOCATION LOCATION ,
'TEMPERATURE' ALARM_TYPE ,
'Machine not maintaining' ALARM_DESC
FROM AVG_TEMP
WHERE AVG_TEMP.AVG_TEMP > AVG_TEMP.MAX_TEMP ;