在 Kusto 中,您可以使用mv-apply
:
datatable(customerId:int, orders:dynamic)
[
201, dynamic([
{
"dept": "/packaging/fruits"
},
{
"dept": "/packaging/vegetables"
}
]),
201,
dynamic([
{
"dept": "/packaging2/fruits2"
},
{
"dept": "/packaging2/vegetables2"
}
])
]
| where customerId == 201
| mv-apply orders on (
summarize orders = make_list(orders.dept)
)
客户ID |
订单 |
201 |
[ “/包装/水果”, “/包装/蔬菜” ] |
201 |
[ “/包装2/水果2”, “/包装2/蔬菜2” ] |
在 ARG 中,mv-apply
不支持,因此您可以使用mv-expand
:
datatable(customerId:int, orders:dynamic)
[
201, dynamic([
{
"dept": "/packaging/fruits"
},
{
"dept": "/packaging/vegetables"
}
]),
201,
dynamic([
{
"dept": "/packaging2/fruits2"
},
{
"dept": "/packaging2/vegetables2"
}
])
]
| where customerId == 201
| extend rn = rand()
| mv-expand orders
| summarize orders = make_list(orders.dept) by rn, customerId
| project-away rn
客户ID |
订单 |
201 |
[ “/包装/水果”, “/包装/蔬菜” ] |
201 |
[ “/包装2/水果2”, “/包装2/蔬菜2” ] |