共用方式為


fork operator

Applies to: ✅Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

平行執行多個取用者運算符。

Syntax

T|fork [name=](subquery) [name=](subquery) ...

Learn more about syntax conventions.

Parameters

Name 類型 Required Description
subquery string ✔️ 支持的查詢運算子下游管線。
name string 子查詢結果數據表的暫存名稱。

Note

  • Avoid using fork with a single subquery.
  • 結果索引標籤的名稱與 name 參數或 as 運算子所提供的名稱相同。

支援的查詢運算符

Returns

Multiple result tables, one for each of the subquery arguments.

Tips

  • 使用 materialize 作為叉子腿或join叉子的替代union專案。 輸入數據流會具體化來快取,然後快取的表達式可用於聯結/聯集腿。

  • Use batch with materialize of tabular expression statements instead of the fork operator.

Examples

The examples in this article use publicly available tables in the help cluster, such as the StormEvents table in the Samples database.

The examples in this article use publicly available tables, such as the Weather table in the Weather analytics sample gallery. 您可能需要修改範例查詢中的資料表名稱,以符合工作區中的資料表。

下列範例會傳回兩個具有未命名數據行的數據表。

StormEvents
| where State == "FLORIDA"
| fork
    ( where DeathsDirect + DeathsIndirect > 1)
    ( where InjuriesDirect + InjuriesIndirect > 1)

Output

此輸出會顯示結果數據表的前幾個數據列和數據行。

StartTime EndTime EpisodeId EventId State EventType InjuriesDirect InjuriesIndirect
2007-02-02T03:17:00Z 2007-02-02T03:25:00Z 3464 18948 FLORIDA Tornado 10 0
2007-02-02T03:37:00Z 2007-02-02T03:55:00Z 3464 18950 FLORIDA Tornado 9 0
2007-03-13T08:20:00Z 2007-03-13T08:20:00Z 4094 22961 FLORIDA Dense Fog 3 0
2007-09-11T15:26:00Z 2007-09-11T15:26:00Z 9578 53798 FLORIDA Rip Current 0 0

Named subqueries

在下列範例中,結果數據表名為 「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)

Output

此輸出會顯示結果數據表的前幾個數據列和數據行。

StartTime EndTime EpisodeId EventId State EventType InjuriesDirect InjuriesIndirect
2007-02-02T03:17:00Z 2007-02-02T03:25:00Z 3464 18948 FLORIDA Tornado 10 0
2007-02-02T03:37:00Z 2007-02-02T03:55:00Z 3464 18950 FLORIDA Tornado 9 0
2007-03-13T08:20:00Z 2007-03-13T08:20:00Z 4094 22961 FLORIDA Dense Fog 3 0
2007-09-11T15:26:00Z 2007-09-11T15:26:00Z 9578 53798 FLORIDA Rip Current 0 0