as 运算符as operator

将名称绑定到运算符的输入表格表达式,从而允许查询多次引用表格表达式的值,而不会中断查询,并通过 let 语句绑定名称。Binds a name to the operator's input tabular expression, thus allowing the query to reference the value of the tabular expression multiple times without breaking the query and binding a name through the let statement.

语法Syntax

T | as [hint.materialized = true] NameT | as [hint.materialized = true] Name

参数Arguments

  • T:表格表达式。T: A tabular expression.
  • 名称:表格表达式的临时名称。Name: A temporary name for the tabular expression.
  • hint.materialized:如果设置为 true,则表格表达式的值将被具体化,就像它已由 materialize() 函数调用包装了一样。hint.materialized: If set to true, the value of the tabular expression will be materialized as if it was wrapped by a materialize() function call.

说明Notes

  • as 提供的名称将用于 unionwithsource= 列、findsource_ 列和 search$table 列。The name given by as will be used in the withsource= column of union, the source_ column of find, and the $table column of search.

  • join 的外部表格输入 ($left) 中使用运算符命名的表格表达式也可用于 join 的表格内部输入 ($right)。The tabular expression named using the operator in a join's outer tabular input ($left) can also be used in the join's tabular inner input ($right).

示例Examples

// 1. In the following 2 example the union's generated TableName column will consist of 'T1' and 'T2'
range x from 1 to 10 step 1 
| as T1 
| union withsource=TableName T2

union withsource=TableName (range x from 1 to 10 step 1 | as T1), T2

// 2. In the following example, the 'left side' of the join will be: 
//      MyLogTable filtered by type == "Event" and Name == "Start"
//    and the 'right side' of the join will be: 
//      MyLogTable filtered by type == "Event" and Name == "Stop"
MyLogTable  
| where type == "Event"
| as T
| where Name == "Start"
| join (
    T
    | where Name == "Stop"
) on ActivityId