fork 運算子
平行執行多個取用者運算符。
語法
T|
fork
[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
傳回
多個結果數據表,每個 子查詢 自變數各一個。
提示
使用
materialize
作為叉子腿或join
叉子的替代union
專案。 輸入數據流會具體化來快取,然後快取的表達式可用於聯結/聯集腿。使用 批次 搭配
materialize
表格式表示式語句,fork
而不是運算符。
範例
本文中的範例會使用 說明叢集中公開可用的數據表,例如 Samples 資料庫中的
StormEvents
數據表。
本文中的範例會使用公開可用的數據表,例如天氣分析中的
StormEvents
數據表,範例數據。
這些範例會輸出多個數據表,其中包含具名和具名數據行。
未命名的子查詢
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 |