你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
fork 运算符
并行运行多个 consumer 运算符。
语法
T|
fork
[name=
](
subquery)
[name=
](
subquery)
...
详细了解语法约定。
参数
客户 | 类型 | 必需 | 说明 |
---|---|---|---|
subquery | string |
✔️ | 支持的查询运算符的下游管道。 |
name | string |
子查询结果表的临时名称。 |
注意
- 请避免将
fork
与单个子查询一起使用。 - 结果选项卡的名称与
name
参数或as
运算符提供的名称相同。
支持的查询运算符
as
count
extend
parse
where
take
project
project-away
project-keep
project-rename
project-reorder
summarize
top
top-nested
sort
mv-expand
reduce
返回
多个结果表,每个子查询参数一个。
提示
在 fork 分支上,请使用
materialize
替换join
或union
。 输入流通过具体化进行缓存,然后缓存的表达式可用于联接/联合腿。将批处理与表格表达式语句的
materialize
一起使用,而不是使用fork
运算符。
示例
本文中的示例使用 帮助群集中的公开可用表,例如 示例 数据库中的
StormEvents
表。
本文中的示例使用公开可用的表,例如天气分析中的
StormEvents
表 示例数据。
这些示例输出包含命名列和 umnamed 列的多个表。
未命名的子查询
StormEvents
| where State == "FLORIDA"
| fork
( where DeathsDirect + DeathsIndirect > 1)
( where InjuriesDirect + InjuriesIndirect > 1)
输出
此输出显示结果表的前几行和列。
StartTime | EndTime | EpisodeId | EventId | 州 | EventType | InjuriesDirect | InjuriesIndirect |
---|---|---|---|---|---|---|---|
2007-02-02T03:17:00Z | 2007-02-02T03:25:00Z | 3464 | 18948 | 佛罗里达州 | 龙卷风 | 10 | 0 |
2007-02-02T03:37:00Z | 2007-02-02T03:55:00Z | 3464 | 18950 | 佛罗里达州 | 龙卷风 | 9 | 0 |
2007-03-13T08:20:00Z | 2007-03-13T08:20:00Z | 4094 | 22961 | 佛罗里达州 | 密集雾 | 3 | 0 |
2007-09-11T15:26:00Z | 2007-09-11T15:26:00Z | 9578 | 53798 | 佛罗里达州 | 激流 | 0 | 0 |
命名子查询
在以下示例中,结果表名为“StormsWithDeaths”和“StormsWithInjuries”。
StormEvents
| where State == "FLORIDA"
| fork
(where DeathsDirect + DeathsIndirect > 1 | as StormsWithDeaths)
(where InjuriesDirect + InjuriesIndirect > 1 | as StormsWithInjuries)
StormEvents
| where State == "FLORIDA"
| fork
StormsWithDeaths = (where DeathsDirect + DeathsIndirect > 1)
StormsWithInjuries = (where InjuriesDirect + InjuriesIndirect > 1)
输出
此输出显示结果表的前几行和列。
StartTime | EndTime | EpisodeId | EventId | 州 | EventType | InjuriesDirect | InjuriesIndirect |
---|---|---|---|---|---|---|---|
2007-02-02T03:17:00Z | 2007-02-02T03:25:00Z | 3464 | 18948 | 佛罗里达州 | 龙卷风 | 10 | 0 |
2007-02-02T03:37:00Z | 2007-02-02T03:55:00Z | 3464 | 18950 | 佛罗里达州 | 龙卷风 | 9 | 0 |
2007-03-13T08:20:00Z | 2007-03-13T08:20:00Z | 4094 | 22961 | 佛罗里达州 | 密集雾 | 3 | 0 |
2007-09-11T15:26:00Z | 2007-09-11T15:26:00Z | 9578 | 53798 | 佛罗里达州 | 激流 | 0 | 0 |