Json 解析-数组值-Azure 流分析

问题描述 投票:0回答:1

我正在尝试分解数组值。但我收到错误“Apply”只能与函数“getarrayelements、getrecordproperties”一起使用。

select a.[id],row1.arrayvalue from input a

CROSS APPLY

[row] AS row1

输入数据为

[

  {

    "id": "ada1",

    "row": [1,2,3]

  },

  {

    "id": "ada2",

    "row": [5,4,7,9]

  }

]

预期输出:


id,row

ada1,1

ada1,2

ada1,3

ada2,5

ada2,4

ada2,7

ada2,9

select a.[id],row1.arrayvalue from input a

CROSS APPLY

[row] AS row1
azure-stream-analytics
1个回答
0
投票

使用下面的代码来实现您的要求。

select rakeshinput.id,row.ArrayValue as row1 from rakeshinput CROSS  APPLY  GetArrayElements(rakeshinput.row)  as  row;

输出:

enter image description here

参考:

https://learn.microsoft.com/en-us/azure/stream-analytics/stream-analytics-parsing-json#convert-array-elements-into-separate-events

© www.soinside.com 2019 - 2024. All rights reserved.