You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何对stored query result执行summarize count()始终返回0?

存储查询结果(Stored Query Result)中summarize count()返回0的问题

更新(2024-04-23):下述问题现已修复。

问题场景

通过以下Kusto命令从StormEvents表取100行数据,创建名为tmp的存储查询结果:

.set stored_query_result tmp with (previewCount = 1, expiresAfter = 1h) <| StormEvents | take 100

执行不同查询时出现不一致结果:

  • stored_query_result("tmp") | count 正常返回100
  • stored_query_result("tmp") | summarize count() by _HasDirectInjuries = InjuriesDirect > 0 返回两行数据,总数合计为100
  • stored_query_result("tmp") | summarize count() 始终返回0

原因分析

问题根源在于创建存储查询结果时指定的previewCount = 1参数:

  • 该参数用于限制存储查询结果的预览数据行数为1,但实际存储的完整数据集仍是100行
  • count运算符会直接读取完整数据集统计行数,因此结果正确
  • 带分组的summarize count() by ...需要对数据分组计算,必须读取完整数据集,所以分组后的总数合计为100
  • 不带分组的summarize count()会优先调用存储查询结果的预览统计数据,而此处预览数据的统计逻辑存在异常,导致返回错误的0值

内容的提问来源于stack exchange,提问作者Philippe Signoret

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 02:25:01