liveBook · Manning

ROWTIME

As explained in Kafka Streams in Action, Second Edition

ROWTIME is a ksqlDB system column containing the timestamp of the underlying Kafka record.

ROWTIME is a ksqlDB system column attached automatically to every row. It holds the timestamp of the underlying Kafka record, so no timestamp field needs to exist in the event value. section 11.2 section 11.3

The timestamp is set by either the producer or the broker, depending on configuration. ROWTIME differs from an event-time column declared in a stream: an event field can be mapped with the WITH clause, while ROWTIME is already available as record metadata. section 11.2 section 11.3

Use ROWTIME when query logic depends on record metadata rather than payload fields:

  • Filter a push query to events in a given time frame, even when records do not define a timestamp column. section 11.3
  • Combine it with ROWPARTITION and ROWOFFSET when inspecting the timestamp, partition, and logical position of incoming Kafka records. section 11.3

Filtering events without a payload timestamp

A stream or table can be queried using ROWTIME in a WHERE condition to return only records from the time window of interest. This refines the client-visible results without requiring a timestamp field in each event. section 11.3

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Defines ROWTIME as automatic record metadata and contrasts it with declared event-time columns, without detailing timestamp configuration.
Examples
Uses a fitness activity stream and time-window filtering of query results without a payload timestamp.
What you can do after
Apply it via ksqlDB WHERE clauses to select records by their Kafka timestamps.
How it connects
Connects ROWTIME to Kafka records, event-time columns, WHERE clauses, ROWPARTITION, ROWOFFSET, and push queries.

This explainer was generated by Manning's knowledge graph from the text of Kafka Streams in Action, Second Edition. The section links point to the parts of the book it draws on.