After using the CollectTop
aggregation function of Azure Stream Analytics, I get back a json-like structure that seems to be like a Dictionary of Dictionaries.
I need to convert this one to a multi-dimensional array which I want to pass to an AzureML UDF.
My question is mostly on how I can interpret this structure in a javascript-UDF, as I'm totally new to Javascript.
This is a sample record (using CollectTop
), but the challenge is how my javascript UDF should look like?
[
{"rank":1,"value":{"engineid":"engine001","tmp":-0.0019,"hum":-0.0002,"eventtime":4}},
{"rank":2,"value":{"engineid":"engine001","tmp":-0.0026,"hum":-0.0002,"eventtime":2}},
{"rank":3,"value":{"engineid":"engine001","tmp":0.0003,"hum":-0.0002,"eventtime":1}}
]
From the above data structure, I'd love to get the following array generated. (taking tmp & hum fields)
[[-0.0019, -0.0002], [-0.0026, -0.0002], [0.0003, -0.0002]]
Any help or insights are welcome.
This question is related to two other questions:
- CollectTop is returning more rows than I would expect in Azure Stream Analytics
- Call Azure Stream Analytics UDF with multi-dimensional array of last 5 records, grouped by record
Best regards