展平 Kusto 查询中的列表列表
Flattening a list of lists in a Kusto Query
我有一个 Kusto 查询 returns 一系列行,每行包含一个以分号分隔的列表。我已经能够将每一行的内容拆分成一个列表,但我无法展平该列表。不幸的是,我对使用 Kusto 还很陌生,所以我有点吃力。
我试过使用函数 "union," "join," "flatten," 并寻找包含单词 "merge" 或 "selectmany" 的函数(函数 I将用于在 c# 中使用 linq 展平)。我也曾尝试搜索类似的 sql 函数,因此我可以在 Kusto 中查找等效查询,但我没有任何运气。
我正在使用查询:
| where Nicknames != ""
| project split(Nicknames, ";")
结果是这样的:
[
"Joe",
"Jim",
"JJ"
]
-------------
[
"Abe"
]
-------------
[
"Hal",
"Harry"
]
我想使用类似 (psudo-Kusto) 的东西:
UserInfo
| where Nicknames != ""
| project split(Nicknames, ";")
| flatten results
| distinct results
...其中 "results" 是上一个操作返回的表。
看看 mv-expand 运算符,例如
datatable(Nicknames:string)["Joe;Jim;JJ", "Abe", "Hal;Harry"]
| extend Nicknames = split(Nicknames, ";")
| mv-expand Nicknames to typeof(string)
| distinct Nicknames
我有一个 Kusto 查询 returns 一系列行,每行包含一个以分号分隔的列表。我已经能够将每一行的内容拆分成一个列表,但我无法展平该列表。不幸的是,我对使用 Kusto 还很陌生,所以我有点吃力。
我试过使用函数 "union," "join," "flatten," 并寻找包含单词 "merge" 或 "selectmany" 的函数(函数 I将用于在 c# 中使用 linq 展平)。我也曾尝试搜索类似的 sql 函数,因此我可以在 Kusto 中查找等效查询,但我没有任何运气。
我正在使用查询:
| where Nicknames != ""
| project split(Nicknames, ";")
结果是这样的:
[
"Joe",
"Jim",
"JJ"
]
-------------
[
"Abe"
]
-------------
[
"Hal",
"Harry"
]
我想使用类似 (psudo-Kusto) 的东西:
UserInfo
| where Nicknames != ""
| project split(Nicknames, ";")
| flatten results
| distinct results
...其中 "results" 是上一个操作返回的表。
看看 mv-expand 运算符,例如
datatable(Nicknames:string)["Joe;Jim;JJ", "Abe", "Hal;Harry"]
| extend Nicknames = split(Nicknames, ";")
| mv-expand Nicknames to typeof(string)
| distinct Nicknames