将游标传递给用户定义函数的正确方法是什么?

What's the correct way to pass a cursor to a user defined function?

我正在尝试将光标传递给这样的函数:

.create-or-alter function GetLatestValues(cursor:string) { 
    Logs | where cursor_after(cursor)
}

但我收到 Error cursor_after(): argument #1 is invalid 回复。有什么我想念的吗?字符串是否使用了错误的数据类型?

此方法适用于 lambda 函数:

let GetLatestValues = (cursor:string) {
   Logs | where cursor_after(cursor)
};
GetLatestValues('') | take 1

默认情况下,在 Kusto 中定义函数会验证存储的函数,如果您使用游标,系统将尝试使用空参数执行此操作,从而导致失败。 您可以使用 skipvalidation=true 参数覆盖此行为(请参阅文档: https://docs.microsoft.com/en-us/azure/kusto/management/functions#create-function)

.create-or-alter function with (skipvalidation = "true")
GetLatestValues(cursor:string)
{ 
    Logs | where cursor_after(cursor)
}