let a = (arg0:long) {
toscalar(
Incidents
| where IncidentId == arg0
| count)
};
range idx from 0 to 11 step 1
| extend a(idx)
我的 kusto 查询字符串就是这样的,而且很容易理解,但是它不起作用。
let a = (arg0:long) {
toscalar(
Incidents
| where IncidentId == arg0
| count)
};
range idx from 0 to 11 step 1
| extend a(idx)
我的 kusto 查询字符串就是这样的,而且很容易理解,但是它不起作用。
You're hitting limitations of user-defined functions, as they're documented here: https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions#restrictions-on-the-use-of-user-defined-functions
you should be able to achieve your goal by doing something like the following (matching the example you provided):
let count_by_incident_id =
Incidents
| summarize count() by IncidentId
;
range idx from 0 to 11 step 1
| join hint.strategy = broadcast (count_by_incident_id)
on $left.idx == $right.IncidentId