如何将自定义列分配给ksql流中的键。在步骤1中,我创建了 messagekey
列并将其指定为 KEY
在第二步中,我将使用udf生成一个uuid并将其分配给 messagekey
它在创建第二个流时给出了这个错误。
错误
Key missing from projection.
The query used to build `ksql_test_step2` must include the key column***messagekey***in its projection.
代码
CREATE STREAM ksql_test_step1
(messagekey varchar KEY,
explode(payload->scores) as scores,
domain varchar)
WITH (kafka_topic='test_topic', value_format='JSON');
create stream ksql_test_step2 WITH (value_format='json') as
select generate_uuid(id,EXTRACTJSONFIELD(scores,'$.source'),
EXTRACTJSONFIELD(scores,'$.code'),
EXTRACTJSONFIELD(scores,'$.version')) as messagekey,
domain
from ksql_test_step1
emit changes;
暂无答案!
目前还没有任何答案,快来回答吧!