简体   繁体   中英

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?

In ksqlDB you can query from the beginning ( SET 'auto.offset.reset' = 'earliest'; ) or end of a topic ( SET 'auto.offset.reset' = 'latest'; ).

You cannot currently (0.8.1 / CP 5.5) seek to an arbitrary offset.

What you can do is start from the earliest offset and then use ROWTIME in your predicate to identify messages that match your requirement.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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