我正在尝试将游标传递给这样的函数:
.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)
}