Search code examples
kqlazure-data-explorer

Why does "summarize count()" on a stored query result always give 0?


Update (2024-04-23): The issue described below has been fixed now.

The following creates a stored query result named "tmp" with 100 rows from StormEvents:

Run query

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

As expected, the following returns 100:

Run query

stored_query_result("tmp") | count
Count
100

Also as expected, this returns two rows that add up to 100:

Run query

stored_query_result("tmp")
| summarize count() by _HasDirectInjuries = InjuriesDirect > 0
_HasDirectInjuries count_
False 98
True 2

But unexpectedly, this always returns 0:

Run query

stored_query_result("tmp") | summarize count()
count_
0

Why doesn't summarize count() work on an stored query result, when count and summarize count() by ... seem to work normally?


Solution

  • This appears to be a bug related to stored query results, we are fixing it. Thank you very much for reporting it!

    Update (2024-04-23): The bug has been fixed now.