[英]How to parse array of struct when creating stream in KSQL
I'm trying to access a key called session ID, here is what the JSON of my message looks like:我正在尝试访问一个名为 session ID 的密钥,这是我消息中的 JSON 的样子:
{
"events":[
{
"data":{
"session_id":"-8479590123628083695"}}]}
This is my KSQL code to create the stream,这是我创建 stream 的 KSQL 代码,
CREATE STREAM stream_test(
events ARRAY< data STRUCT< session_id varchar> >
) WITH (KAFKA_TOPIC='my_topic',
VALUE_FORMAT='JSON')
But I get this error,但我得到这个错误,
KSQLError: ("line 4:22: mismatched input 'STRUCT' expecting {'(', 'ARRAY', '>'}", 40001, None)
Does anyone know how to unpack this kind of structure?有谁知道如何解压这种结构? I'm struggling to find examples我正在努力寻找例子
My solution:我的解决方案:
events ARRAY< STRUCT<data STRUCT< session_id varchar >> >
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.