如何在 Select 语句中 select 记录的键

How to select the Key of a Record in a Select statement

我创建了这条记录:

new ProducerRecord(topic = "petstore-msg-topic", key = msg.username, value = s"${msg.route},${msg.time}")

我现在想做这样的事情:

CREATE STREAM petstorePages (KEY, route VARCHAR, time VARCHAR) \
                  WITH (KAFKA_TOPIC='petstore-msg-topic', VALUE_FORMAT='DELIMITED');

是否可以在 Stream 创建中访问密钥,或者我是否必须在值中也包含密钥?

自动添加并调用 ROWKEY

KSQL adds the implicit columns ROWTIME and ROWKEY to every stream and table, which represent the corresponding Kafka message timestamp and message key

https://docs.confluent.io/current/ksql/docs/syntax-reference.html#id16