0

The following command does not produce a consistent ordering of items:

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

But upon reading the documentation (see here) it states the following:

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.

Is this a bug or am I doing something wroing?

Ivan Glasenberg
  • 29,865
  • 2
  • 44
  • 60
Dave New
  • 38,496
  • 59
  • 215
  • 394

2 Answers2

1

As per this issue @MohitVerma mentioned, makeset() should not support ordering, and they are planning to correct the doc : 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.

You can use makelist() as a workaround, which does support ordering as per my testing.

Ivan Glasenberg
  • 29,865
  • 2
  • 44
  • 60
0

Please check this answer for the similar type of operation.

How to order item in Makeset?

Below code worked for me-

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

enter image description here

You can follow this thread for the code snippet , marked the answer for closing this thread.

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)
Mohit Verma
  • 5,140
  • 2
  • 12
  • 27