不要在结果中返回批处理



我可以使用批处理进行时间计算,但最终不包括在结果中吗?

例如,我想使用'时态'表来计算其他查询,但我不想在结果中稍后获得它(因为它太大了)。也就是说,结果应该只包含表X和表Y。

requests
| take 1000 
| as temporal;
temporal | summarize count() | as X;
temporal | summarize avg(duration) | as Y;

注。在我的场景中使用'let'是不可能的

使用此解决方案,您将获得您感兴趣的结果集。
您可能会认为代码不那么"干净"。

// Sample data generation. Not part of the solution.
let requests = materialize(range i from 1 to 1000000 step 1 | extend duration = 1d * rand());
// Solution starts here.
requests
| take 1000 
| as hint.materialized=true temporal
| summarize count() | as X;
temporal | summarize avg(duration) | as Y;

小提琴

使用此解决方案,您将获得一个额外的结果集,但是它是空的。

注:
您可能希望使用hint.materialized=true来防止时间数据集被计算两次。

// Sample data generation. Not part of the solution.
let requests = materialize(range i from 1 to 1000000 step 1 | extend duration = 1d * rand());
// Solution starts here.
requests
| take 1000 
| as hint.materialized=true temporal
| take 0
;
temporal | summarize count() | as X;
temporal | summarize avg(duration) | as Y;

小提琴

最新更新