Azure 流分析参考输入联接

Azure Stream Analytics Reference Input Join

0

我正在尝试使用以下查询来连接流输入 (deviceinput) 和参考输入 (refinputpdjson):

以下是我对流分析作业的输入:

输入 1:来自 IoT 中心的流输入 输入 2:来自 Azure Blob 存储的参考数据

SELECT 
din.EventProcessedUtcTime,
din.deviceid as streamdeviceid,
din.heartrate as streamheartrate,
refin.deviceid as refdeviceid,
refin.patientid as refpatientid 
FROM 
deviceinput din 
TIMESTAMP BY EventProcessedUtcTime 
LEFT OUTER JOIN 
refinputpdjson refin 
ON din.deviceid = refin.deviceid

但失败的原因如下:

连接谓词没有时间限制。数据流之间的 JOIN 操作需要指定匹配事件之间的最大时间距离。请将 DATEDIFF 添加到 JOIN 条件。示例:SELECT input1.a, input2.b FROM input1 JOIN input2 ON DATEDIFF(minute, input1, input2) BETWEEN 0 AND 10

如错误所示,

JOIN operation between data streams requires specifying max time distances between matching events.

所以你可以尝试这样的事情:

SELECT 
    din.EventProcessedUtcTime, din.deviceid as streamdeviceid, din.heartrate as streamheartrate, refin.deviceid as refdeviceid, refin.patientid as refpatientid 
FROM deviceinput din TIMESTAMP BY EventProcessedUtcTime 
LEFT OUTER JOIN refinputpdjson refin TIMESTAMP BY EventEndUtcTime
ON din.deviceid = refin.deviceid
AND DATEDIFF(minute,din,refin) BETWEEN 0 AND 15

更详细的可以参考这篇documentation

这是一个 Azure 服务错误。它由 MS Team 解决。 现在可以正常使用了。

谢谢, 卡姆莱什霍拉姆