我有来自带有嵌套列表的KEPServerEx数据,因此我需要进行交叉应用以将各个值从传入流发送到我的Blob。我利用该帖子(iterate nested list in json msg by cql stream analytics)使查询工作了几分钟,但无法再获得正确的输出。
一条消息看起来像这样:
[
{
"timestamp": 1575933997508,
"values": [
{
"id": "Channel1.Device1.RANDOM1",
"v": 5,
"q": 1,
"t": 1575933987573
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 196,
"q": 1,
"t": 1575933988076
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 56,
"q": 1,
"t": 1575933988570
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 104,
"q": 1,
"t": 1575933989077
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 24,
"q": 1,
"t": 1575933989567
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 177,
"q": 1,
"t": 1575933990069
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 168,
"q": 1,
"t": 1575933990575
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 113,
"q": 1,
"t": 1575933991067
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 189,
"q": 1,
"t": 1575933991572
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 96,
"q": 1,
"t": 1575933992075
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 15,
"q": 1,
"t": 1575933992567
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 179,
"q": 1,
"t": 1575933993074
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 22,
"q": 1,
"t": 1575933993569
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 98,
"q": 1,
"t": 1575933994073
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 9,
"q": 1,
"t": 1575933994575
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 142,
"q": 1,
"t": 1575933995071
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 54,
"q": 1,
"t": 1575933995576
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 174,
"q": 1,
"t": 1575933996070
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 188,
"q": 1,
"t": 1575933996567
},
{
"id": "Channel1.Device1.RANDOM1",
"v": 45,
"q": 1,
"t": 1575933997073
}
]
}
]
我用来成功地将上述消息列表中的值拆分成单个值的查询是:
SELECT
event.timestamp as messageTS,
[values].ArrayValue.id,
[values].ArrayValue.v,
[values].ArrayValue.t as valueTS
FROM
brewingmqtt AS event
CROSS APPLY getarrayelements(event.eachvalue) AS [values]
不幸的是,这现在使我在执行测试时返回0行,而我无法弄清丢失的内容。