這今天是不能直接在流分析查詢語言將其轉換成單獨的事件 - 敬請期待用於即將到來的可擴展性改進。
您可能可以使用HoppingWindow生成常規事件(例如每秒),然後加入您的流以每秒生成事件,條件是它們不超過傳入事件之前的[持續時間]秒。
事情是這樣的:
WITH
InputWithTimestamp AS
(
SELECT
System.Timestamp as timestamp, [value], [duration]
FROM input
),
RegularEvents AS
(
SELECT
System.Timestamp as timestamp,
count()
FROM InputWithTimestamp
GROUP BY HoppingWindow(second, 1000, 1) -- assuming at least one event arrives evry 1000 seconds
)
SELECT
RegularEvents.timestamp,
InputWithTimestamp.value/InputWithTimestamp.[duration] as [value]
FROM
RegularEvents
JOIN
InputWithTimestamp
ON DATEDIFF(second, RegularEvents, InputWithTimestamp) BETWEEN 0 AND 1000 -- assuming 1000 is max possible duration
AND DATEDIFF(second, RegularEvents.timestamp, InputWithTimestamp.timestamp) BETWEEN 0 AND InputWithTimestamp.[duration]