Kusto - bin() 如何汇总时间戳

PYY*_*PYY 11 azure-data-explorer

学习Kusto,不明白bin()函数如何对时间戳进行分组:

StormEvents
| where StartTime > datetime(2007-02-14) and StartTime < datetime(2007-03-21)
| summarize event_count = count() by bin(StartTime, 7d)
Run Code Online (Sandbox Code Playgroud)

结果是:

StartTime                           | event_count
**2007-02-12** 00:00:00.0000000     | 535
2007-02-19 00:00:00.0000000         | 1652
2007-02-26 00:00:00.0000000         | 1688
2007-03-05 00:00:00.0000000         | 442
2007-03-12 00:00:00.0000000         | 796
2007-03-19 00:00:00.0000000         | 54
Run Code Online (Sandbox Code Playgroud)

问题:为什么结果的第一个日期是从 2-12 开始,而不是我的代码所示的 2-14?

先感谢您

Sla*_*k N 11

当您写入时,by bin(StartTime, 7d)所有结果将被分箱到 7 天的存储桶中,第一个存储桶从 01/01/0001(第一年的 1 月 1 日)开始。


Yon*_*i L 4

如果您想控制bin()的起点,可以使用bin_at()https ://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/binatfunction