Extends the columns of a fact table with values looked-up in a dimension table.
FactTable | lookup kind=leftouter (DimensionTable) on CommonColumn, $left.Col1 == $right.Col2
Here, the result is a table that extends the
$left) with data from
DimensionTable (referenced by
by performing a lookup of each pair (
Col) from the former table
with each pair (
Col2) in the latter table.
For the differences between fact and dimension tables, see fact and dimension tables.
lookup operator performs an operation similar to the join operator
with the following differences:
- The result doesn't repeat columns from the
$righttable that are the basis for the join operation.
- Only two kinds of lookup are supported,
leftouterbeing the default.
- In terms of performance, the system by default assumes that the
$lefttable is the larger (facts) table, and the
$righttable is the smaller (dimensions) table. This is exactly opposite to the assumption used by the
lookupoperator automatically broadcasts the
$righttable to the
$lefttable (essentially, behaves as if
hint.broadcastwas specified). This limits the size of the
If the right side of the lookup is larger than several tens of MBs, the query will fail.
You can run the following query to estimate the size of the right side in bytes:
rightSide | summarize sum(estimate_data_size(*))
|LeftTable||string||✓||The table or tabular expression that is the basis for the lookup. Denoted as
|RightTable||string||✓||The table or tabular expression that is used to "populate" new columns in the fact table. Denoted as
|Attributes||string||✓||A comma-delimited list of one or more rules that describe how rows from LeftTable are matched to rows from RightTable. Multiple rules are evaluated using the
||string||Determines how to treat rows in LeftTable that have no match in RightTable. By default,
|Equality by name||ColumnName||
|Equality by value||
In case of 'equality by value', the column names must be qualified with the applicable owner table denoted by
A table with:
- A column for every column in each of the two tables, including the matching keys. The columns of the right side will be automatically renamed if there are name conflicts.
- A row for every match between the input tables. A match is a row selected from one table that has the same value for all the
onfields as a row in the other table.
- The Attributes (lookup keys) will appear only once in the output table.
kindis unspecified or
kind=leftouter, then in addition to the inner matches, there's a row for every row on the left (and/or right), even if it has no match. In that case, the unmatched output cells contain nulls.
kind=inner, then there's a row in the output for every combination of matching rows from left and right.
let FactTable=datatable(Row:string,Personal:string,Family:string) [ "1", "Bill", "Gates", "2", "Bill", "Clinton", "3", "Bill", "Clinton", "4", "Steve", "Ballmer", "5", "Tim", "Cook" ]; let DimTable=datatable(Personal:string,Family:string,Alias:string) [ "Bill", "Gates", "billg", "Bill", "Clinton", "billc", "Steve", "Ballmer", "steveb", "Tim", "Cook", "timc" ]; FactTable | lookup kind=leftouter DimTable on Personal, Family