我的kafka发送以下json
'{
"eventSummaryList": [
{
"customer": 1,
"data": "{\"cliente\":\"52264\",\"data_posicao\":\"1484250682\",\"gps_valido\":\"1\",\"horimetro\":\"0\",\"ibuttonPart1\":\"0\",\"ibuttonPart2\":\"0\",\"id_evento\":\"null\",\"id_motorista\":\"0\",\"ignicao\":\"0\",\"latitude\":\"-25.5385123\",\"longitude\":\"-49.1995068\",\"odometro\":\"0\",\"pos_memoria\":\"0\",\"veiculo\":\"103970\",\"velocidade\":\"0\"}",
"identifierRule": 1770,
"identifierSummary": 17,
"rule": "rota_fora",
"status": 1,
"vehicle": 103970
},
{
"customer": 2,
"data": "{\"cliente\":\"52264\",\"data_posicao\":\"1484250682\",\"gps_valido\":\"1\",\"horimetro\":\"0\",\"ibuttonPart1\":\"0\",\"ibuttonPart2\":\"0\",\"id_evento\":\"null\",\"id_motorista\":\"0\",\"ignicao\":\"0\",\"latitude\":\"-25.5385123\",\"longitude\":\"-49.1995068\",\"odometro\":\"0\",\"pos_memoria\":\"0\",\"veiculo\":\"103970\",\"velocidade\":\"0\"}",
"identifierRule": 8,
"identifierSummary": 7,
"rule": "velocidade_maior",
"status": 1,
"vehicle": 103970
}
]
}'
我创建了这个连续的transformr
CREATE CONTINUOUS TRANSFORM sensor_event_process_transform AS
SELECT cast ( cast(pack ->>'eventSummaryList' as json)->>'customer' as bigint ) as customer
FROM pipeline_kafka.sensor_event_process_stream
然后执行程序 update_sensor_event_process_t();
但我的日志 pipelineDB 返回这个......
上下文:JSON 数据,第 1 行:{ COPY sensor_event_process_stream,第 1 行,列包:“{”日志:[pipeline_kafka] sensor_event_process_stream <- topicNotificationProcess (PID 25201):无法处理批处理,丢弃 8 条消息错误:类型的输入语法无效json DETAIL:输入字符串意外结束。
如何遍历 json 数组并仅获取客户列的内容?