makeset 操作不保留排序?

makeset operation not preserve ordering?

以下命令不会生成一致的项目排序:

KubePodInventory
| where ClusterName == "mycluster"
| distinct Computer
| order by Computer asc
| summarize makeset(Computer)

但在阅读文档 (see here) 后,它说明如下:

Like makelist, makeset also works with ordered data and will generate the arrays based on the order of the rows that are passed into it.

这是一个错误还是我做错了什么?

请检查此答案以了解类似类型的操作。

How to order item in Makeset?

下面的代码对我有用-

requests | summarize makeset(client_City) by client_City | distinct client_City | order by client_City asc

您可以关注此线程获取代码片段,标记为关闭此线程的答案。

https://github.com/MicrosoftDocs/azure-docs/issues/24135#issuecomment-460185491

requests | summarize makeset(client_City) by client_City | distinct client_City | order by client_City asc | summarize makelist(client_City)

根据此 issue @MohitVerma mentioned, makeset() should not support ordering, and they are planning to correct the doc与 makelist 一样,makeset 也可以处理有序数据,并将根据传递给它的行的顺序生成数组。

您可以使用 makelist() 作为解决方法,它确实支持根据我的测试进行排序。