想要自定义排序顺序?

Kusto Custom Sort Order?

如何在 Kusto 中执行自定义排序顺序?

示例查询:

//==================================================//
// Assign variables
//==================================================//
let varStart = ago(2d);
let varEnd = now();
let varStorageAccount = 'stgacctname';
//==================================================//
// Filter table
//==================================================//
StorageBlobLogs
| where TimeGenerated between (varStart .. varEnd)
  and AccountName == varStorageAccount
| sort by OperationName

需要:

这可能吗?

使用辅助列,如下所示:

datatable(OperationName:string, SomethingElse:string)
[
    "AppendFile", "3",
    "GetBlob", "1",
    "AppendFile", "4",
    "GetBlob", "2"
]
| extend OrderPriority =
    case(OperationName == "GetBlob", 1,
         OperationName == "AppendFile", 2,
         3)
| order by OrderPriority asc, SomethingElse asc 
| project-away OrderPriority

输出:

OperationName SomethingElse
GetBlob 1
GetBlob 2
AppendFile 3
AppendFile 4