The window start time is reflected in the ROWTIME
of the KSQL message, and in the timestamp of the Kafka message. This timestamp you can access using the standard APIs for working with Kafka messages.
AFAIK the kafka-console-consumer
doesn't support showing timestamp. However something like kafkacat
does.
Here's some aggregated data in KSQL, with the ROWTIME
showing the start of the window (and TIMESTAMPTOSTRING
being used to pretty-print it):
ksql> SELECT TIMESTAMPTOSTRING(ROWTIME, 'yyyy-MM-dd HH:mm:ss'), ROWTIME, STARS, STAR_COUNT FROM RATINGS_AGG2;
2018-06-27 09:30:00 | 1530091800000 | 1 | 2
2018-06-27 09:30:00 | 1530091800000 | 4 | 6
2018-06-27 09:30:00 | 1530091800000 | 2 | 2
2018-06-27 09:30:00 | 1530091800000 | 3 | 3
Now the same topic in kafkacat
:
$ kafkacat -b localhost:9092 -C -K: \
-f '\nTimestamp: %T\t\tValue (%S bytes): %s' \
-t RATINGS_AGG2
Timestamp: 1530091800000 Value (26 bytes): {"STAR_COUNT":1,"STARS":1}
Timestamp: 1530091800000 Value (26 bytes): {"STAR_COUNT":2,"STARS":1}
Timestamp: 1530091800000 Value (26 bytes): {"STAR_COUNT":3,"STARS":3}
Timestamp: 1530091800000 Value (26 bytes): {"STAR_COUNT":5,"STARS":1}
Timestamp: 1530091800000 Value (26 bytes): {"STAR_COUNT":6,"STARS":3}
Timestamp: 1530091800000 Value (26 bytes): {"STAR_COUNT":7,"STARS":1}
Timestamp: 1530091800000 Value (26 bytes): {"STAR_COUNT":7,"STARS":3}
Timestamp: 1530091800000 Value (26 bytes): {"STAR_COUNT":9,"STARS":1}
Timestamp: 1530091800000 Value (26 bytes): {"STAR_COUNT":9,"STARS":3}
1530008581051
? – Michael G. Noll