Transformations using streaming analytics
One of the common themes that you might notice in streaming queries is that if there is any kind of transformation involved, there will always be windowed aggregation that has to be specified. Let's take the example of counting the number of distinct entries in a time frame.
The COUNT and DISTINCT transformations
This type of transformation can be used to count the number of distinct events that have occurred in a time window. Here is an example to count the number of unique trips in the last 10 seconds:
SELECT COUNT(DISTINCT tripId) AS TripCount, System.TIMESTAMP() AS Time INTO [Output] FROM [Input] TIMESTAMP BY createdAt GROUP BY TumblingWindow(second, 10)
Next, let's look at an example where we can cast the type of input in a different format.
CAST transformations
The CAST
transformation can be used to convert the data type on the fly. Here is an example to convert...