ksql主键和with KEY有什么区别

ksql what is the difference between the primary key and with KEY

ksql.

  1. 主键和with KEY then create ktable有什么区别?
  2. 是否应该同时应用?

在这两种情况下,它们将代表消息键,当您考虑 Kafka 如何处理“表”时,这有点有意义。

但这两种情况也有区别:在第二种情况下,我们更多地将KEY字段视为一种优化技术。正如您所注意到的,可以在消息值中找到相同的字段,因此将从那里提取它。

引用自官方文档页面:

 If the Kafka message key is also present as a field/column in the Kafka message value, you may set this property to associate the corresponding field/column with the implicit ROWKEY column (message key)

关于你的第二个问题,如果你查看最新版本的 documentation 你会发现第二个查询不再有效。