如何获取滚动窗口的开始和结束时间?
我获得了创建和更新时间字段的数据流。 我需要通过tumblingwindow
1小时来获得创建和更新的记录。
如何在tumblingwindow
开始和结束时间之间过滤createon?
I get a stream of data that has CreatedOn and UpdatedOn time field.
I need to get a count of Created and Updated records by TumblingWindow
of 1 hour.
How can I filter CreatedOn to be between the TumblingWindow
start and end time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在下面编辑了以下评论
我将做出以下假设:
假设您的输入记录如下所示:
通过以下查询,您可以获得每小时创建/更新的行数:
这里给您:
请注意这里的窗口时间是如何在挂钟时间上完成的(实时服务的到达时间,或者当我执行本地查询时在此处查询开始时间)在 VS Code 中运行),所以我的 2 个操作被重新组合在一个窗口上。实时运行时,如果操作时间和 ASA 接收行(到达时间)之间没有太多延迟,它们肯定会处于不同的时间窗口中。
如果您想对操作时间强制执行时间进度,可以使用 TIMESTAMP BY 子句来实现:
现在输出变为:
Edited following comments below
I'll make the following assumptions:
Let's say your input records look like:
With the following query you can get a count of created/updated rows per hour:
Here giving you:
Notice how the windowing is done here on the wall clock time (arrival time on the live service, or here query start time when I do a local run in VS Code), so my 2 operations are regrouped on a single window. When running live, if you don't have much delay between the operation time and when ASA receives the row (arrival time), they will surely be in separate time windows.
If you want to enforce time progression on the operation time, you can do so with the
TIMESTAMP BY
clause:Now the output becomes: