在火花结构化流中访问当前水印

发布于 2025-01-22 07:36:49 字数 163 浏览 4 评论 0原文

有什么方法可以访问火花结构化流中的当前水印值?

我想以活动时间顺序处理事件,以查找序列的模式。为此,我一直在考虑使用FlatmapGroupswithState和缓冲事件,直到水印通过(并避免进行缓冲后事件)并一对一地对其进行处理。但是我不知道如何访问当前水印来完成。火花结构流中是否可能发生事件?

Is there any way to access current watermark value in Spark Structured Streaming?

I'd like to process events in their event-time order to find patterns in sequences. To do it I was thinking of using flatMapGroupsWithState and buffer events till the watermark passes (and avoid buffering late events) and process them one-by-one. But I don't know how to access current watermark to do it. Is it event possible in Spark Structure Streaming?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

魔法少女 2025-01-29 07:36:49

您可以从streamingquery对象访问streamQueryProgress

query.lastProgress()/recentProgress()

它将包含eventtime.watermark字段

类似:

{
  "id" : "eb7202da-9e60-4983-89fc-e1251aebf89d",
  "runId" : "969555bd-6189-4b70-a101-3b5917cea965",
  "name" : "my-query",
  "timestamp" : "2023-01-05T16:46:43.372Z",
  "batchId" : 6,
  "numInputRows" : 0,
  "inputRowsPerSecond" : 0.0,
  "processedRowsPerSecond" : 0.0,
  "durationMs" : {
    "latestOffset" : 7,
    "triggerExecution" : 7
  },
  "eventTime" : {
    "watermark" : "2023-01-01T09:44:11.000Z"
  },
  "stateOperators" : [ {
    "operatorName" : "stateStoreSave",
...etc
}

You can access the StreamingQueryProgress from your StreamingQuery object:

query.lastProgress()/recentProgress()

It will contain an eventTime.watermark field

something like:

{
  "id" : "eb7202da-9e60-4983-89fc-e1251aebf89d",
  "runId" : "969555bd-6189-4b70-a101-3b5917cea965",
  "name" : "my-query",
  "timestamp" : "2023-01-05T16:46:43.372Z",
  "batchId" : 6,
  "numInputRows" : 0,
  "inputRowsPerSecond" : 0.0,
  "processedRowsPerSecond" : 0.0,
  "durationMs" : {
    "latestOffset" : 7,
    "triggerExecution" : 7
  },
  "eventTime" : {
    "watermark" : "2023-01-01T09:44:11.000Z"
  },
  "stateOperators" : [ {
    "operatorName" : "stateStoreSave",
...etc
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文