英文:
How to access multiple kusto let statement results in a consecutive query?
问题
我想查询在执行之前bin()
函数的输入值,其中三个点(...)表示一个整数变量:
在ADX中,通过悬停在变量上方,可以查看bin_size
,如下图所示:
因此,我认为我可以访问变量y_bin_size
和x_bin_size
来进行我的最终查询。
如何访问第一个let
查询的内部结果?
是否可以将这个操作合并成一个查询?
非常感谢。
英文:
I'd like to query the input value for the bin()
function prior to the execution, in which the three dots (...) represent a integer variable:
let bin_size =
T
| project X, Y
| summarize y_bin_size=(max(Y) - min(Y)) / ..., x_bin_size=(max(X) - min(X)) / ...;
let result =
T
| project X, Y
| summarize Count=count() by bin(X, bin_size.x_bin_size), bin(Y, bin_size.y_bin_size);
result
In ADX the bin_size is shown by hovering over the variable, as shown in the image:
Therefore, I suppose, I could access the variables y_bin_size
and x_bin_size
for my final query.
How can I access the inner results of the first let query?
Can I combine this in one query?
Thanks a lot.
答案1
得分: 1
你可以尝试类似以下方式:
- 在查询的第一部分:计算并存储类型为
dynamic
的标量属性包中的分箱大小。 - 在查询的另一部分中,访问属性(
x
和y
)从步骤 1 中的属性包中。
let bin_sizes = toscalar(
T
| summarize bag_pack("y", (max(Y) - min(Y)) / 5,
"x", (max(X) - min(X)) / 6)
)
;
let result =
T
| summarize Count=count() by
bin(X, todouble(bin_sizes.x)),
bin(Y, todouble(bin_sizes.y))
;
result
英文:
you could try something like this:
- in the first part of the query: calculate and store the bin sizes in a scalar property bag of type
dynamic
. - access the properties (
x
andy
) from the bag in #1 in the other part of your query.
let bin_sizes = toscalar(
T
| summarize bag_pack("y", (max(Y) - min(Y)) / 5,
"x", (max(X) - min(X)) / 6)
)
;
let result =
T
| summarize Count=count() by
bin(X, todouble(bin_sizes.x)),
bin(Y, todouble(bin_sizes.y))
;
result
``
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论