如何使用JavaScript UDF将Azure Stream Analytics中的“类似于字典"的结构转换为多维数组? [英] How to convert a 'dictionary-like' structure in Azure Stream Analytics to a multi dimensional array with a javascript UDF?

查看:52
本文介绍了如何使用JavaScript UDF将Azure Stream Analytics中的“类似于字典"的结构转换为多维数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Azure Stream Analytics的 CollectTop 聚合函数后,我得到了一个类似于json的结构,该结构似乎像是Dictionary of Dictionary.我需要将其转换为多维数组,然后传递给AzureML UDF.

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.

我的问题主要是关于如何在javascript-UDF中解释这种结构,因为我对Java完全陌生.

My question is mostly on how I can interpret this structure in a javascript-UDF, as I'm totally new to Javascript.

这是一个示例记录(使用 CollectTop ),但是挑战在于我的JavaScript UDF应该是什么样子?

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}}
]

根据上面的数据结构,我很想生成以下数组.(以tmp和hum字段表示)

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]]

欢迎任何帮助或见解.

这个问题与另外两个问题有关:

This question is related to two other questions:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆