从键和值列表中创建一个 属性 包

Make a property bag from a list of keys and values

我有一个包含键的列表和另一个包含值的列表(通过拆分日志行获得)。如何将两者结合起来在 Kusto 中制作一个 proeprty-bag?

let headers = pack_array("A", "B", "C");
datatable(RawData:string)
[
    "1,2,3",
    "4,5,6",
]
| expand fields = split(RawData, ",")
| expand dict = ???

预计:

dict
-----
{"A": 1, "B": 2, "C": 3}
{"A": 4, "B": 5, "C": 6}

这是一个选项,它使用以下组合:

let keys = pack_array("A", "B", "C");
datatable(RawData:string)
[
    "1,2,3",
    "4,5,6",
]
| project values = split(RawData, ",")
| mv-apply with_itemindex = i key = keys to typeof(string) on (
    summarize dict = make_bag(pack(key, values[i]))
)
values dict
[
"1",
"2",
"3"
]
{
"A": "1",
"B": "2",
"C": "3"
}
[
"4",
"5",
"6"
]
{
"A": "4",
"B": "5",
"C": "6"
}