简体   繁体   English

我们是否可以选择从特定时间段/时间戳获取 KSQL 流中的数据

[英]Do we have a option to get data in KSQL streams from specific time-period/Timestamp

I know, in KSQL we can set offset to earliest or latest But can we get data from specific time period ie I need to get data inserted to a topic from 06-May-2020?我知道,在 KSQL 中,我们可以将偏移量设置为最早或最晚但是我们可以从特定时间段获取数据,即我需要从 2020 年 5 月 6 日开始将数据插入到主题中吗?

In ksqlDB you can query from the beginning ( SET 'auto.offset.reset' = 'earliest'; ) or end of a topic ( SET 'auto.offset.reset' = 'latest'; ).在 ksqlDB 中,您可以从主题的开头( SET 'auto.offset.reset' = 'earliest'; )或主题的结尾( SET 'auto.offset.reset' = 'latest'; )查询。

You cannot currently (0.8.1 / CP 5.5) seek to an arbitrary offset.您目前 (0.8.1 / CP 5.5) 无法寻找任意偏移量。

What you can do is start from the earliest offset and then use ROWTIME in your predicate to identify messages that match your requirement.可以做的是从最早的偏移量开始,然后在谓词中使用ROWTIME来识别符合您要求的消息。

SELECT * 
  FROM MY_SOURCE_STREAM 
WHERE  ROWTIME>=1588772149620

Note that this scans through sequentially so depending on how much data you have in your topic may not be particularly fast.请注意,这是按顺序扫描的,因此取决于您在主题中拥有的数据量可能不是特别快。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM