KQL 更新策略的数据摄取问题;查询架构与 table 架构不匹配

Data ingestion issue with KQL update policy ; Query schema does not match table schema

我正在编写一个函数,它接收原始数据 table(包含 multijson 遥测数据)并将其重新格式化为多个列。我使用 .set MyTable <| myfunction|limit 0 根据函数创建我的目标 table 并使用更新策略提醒我的目标 table。

这是代码:

.set-or-append MyTargetTable <| 
   myfunction
   | limit 0

.alter table MyTargetTable policy update 
@'[{ "IsEnabled": true, "Source": "raw", "Query": "myfunction()", "IsTransactional": false, "PropagateIngestionProperties": false}]'

但我遇到摄取失败:这是摄取失败消息:

调用更新策略失败。目标 Table = 'MyTargetTable', 查询 = '

let raw = __table("raw", 'All', 'AllButRowStore') 
| where extent_id() in (guid(659e3b3c-6859-426d-9c37-003623834455));
myfunction()': Query schema does not match table schema 

我仔细检查了查询架构和目标 table;他们是一样的 。我不确定这个错误是什么意思。 另外,我 运行 指望 raw 和 mytarget tables;存在相对较大的差异(我的目标有 400 行,原始 table 有 2000 行)。

如有任何建议,我们将不胜感激。

一般来说 - 要找到模式之间不匹配的根源,您可以 运行 遵循以下几行内容,并过滤差异:

myfunction
| getschema 
| join kind=leftouter (
    table('MyTargetTable')
    | getschema 
) on ColumnOrdinal, ColumnType

此外 - 您应该确保您在更新策略中使用的函数的输出模式是 'stable',即不受输入数据的影响

  • pivot()bag_unpack() 等一些查询插件的输出模式取决于输入数据,因此不建议在更新策略中使用它们。