从空窗口生成输出

时间:2015-10-23 14:18:23

标签: azure azure-stream-analytics

是否可以使用" group by window"从流分析查询生成输出?表达式,当窗口为空时?

例如,在this示例中,查询:

SELECT System.Timestamp as WindowEnd, SwitchNum, COUNT(*) as CallCount FROM CallStream TIMESTAMP BY CallRecTime GROUP BY TUMBLINGWINDOW(s, 5), SwitchNum

产生输出:

  • 2015-04-15T22:10:40.000Z UK 1
  • 2015-04-15T22:10:40.000Z US 1
  • 2015-04-15T22:10:45.000Z China 1
  • 2015-04-15T22:10:45.000Z德国1
  • 2015-04-15T22:10:45.000Z UK 3
  • 2015-04-15T22:10:45.000Z US 1
  • 2015-04-15T22:10:50.000Z Australia 2
  • ...

是否有可能使它产生类似的东西:

  • 2015-04-15T22:10:40.000Z China 0
  • 2015-04-15T22:10:40.000Z Germany 0
  • 2015-04-15T22:10:40.000Z UK 1
  • 2015-04-15T22:10:40.000Z US 1
  • 2015-04-15T22:10:40.000Z Australia 0
  • 2015-04-15T22:10:45.000Z China 1
  • 2015-04-15T22:10:45.000Z德国1
  • 2015-04-15T22:10:45.000Z UK 3
  • 2015-04-15T22:10:45.000Z US 1
  • 2015-04-15T22:10:45.000Z Australia 0
  • ...

目标是使用跳跃窗口检测最近x秒内是否没有事件。

1 个答案:

答案 0 :(得分:0)

使用带有SwitchNum值查找表的LEFT JOIN,如果窗口中没有值,则会产生NULL结果。

此博客文章更详细地解释:http://blogs.msdn.com/b/streamanalytics/archive/2014/12/09/how-to-query-for-all-events-and-no-event-scenarios.aspx