Sample use caseÂ
In this sample, we have a three automated tollbooth and cars pass through every few minutes. The goal is to calculate how many cars have passed through in a given duration.
- No Partition:
SELECT COUNT(*) AS Count, TollBoothId FROM Input1 GROUP BY TumblingWindow(minute, 3), TollBoothId, PartitionId
- Partitioned Query:
SELECT COUNT(*) AS Count, TollBoothId FROM Input1 Partition By PartitionId GROUP BY TumblingWindow(minute, 3), TollBoothId, PartitionId
- Split query with Partition and Non-Partition:
WITH Step1 AS ( SELECT COUNT(*) AS Count, TollBoothId, PartitionId FROM Input1 Partition By PartitionId GROUP BY TumblingWindow(minute, 3), TollBoothId, PartitionId ) SELECT SUM(Count) AS Count, TollBoothId FROM Step1 GROUP BY TumblingWindow(minute, 3), TollBoothId
Summary of the result with the total Streaming Unit: