Comment on page
Lookup UDF Join
For more information about using JOINs with the multi-stage query engine, see JOINs.
The UDF function syntax is listed as below:
[ '''dimJoinKey''', factJoinKey ]*
dimTableName of the dim table to perform the lookup on.
dimColToLookUpThe column name of the dim table to be retrieved to decorate our result.
dimJoinKeyThe column name on which we want to perform the lookup i.e. the join column name for dim table.
factJoinKeyThe column name on which we want to perform the lookup against e.g. the join column name for fact table
- 1.all the dim-table-related expressions are expressed as literal strings, this is the LOOKUP UDF syntax limitation: we cannot express column identifier which doesn't exist in the query's main table, which is the
- 2.the syntax definition of
[ '''dimJoinKey''', factJoinKey ]*indicates that if there are multiple dim partition columns, there should be multiple join key pair expressed.
Here are some of the examples
Consider the table
and dim table
several acceptable queries are:
LOOKUP('dimBaseballTeams', 'teamName', 'teamID', teamID) AS teamName,
LOOKUP('dimBaseballTeams', 'teamAddress', 'teamID', teamID) AS teamAddress
teamName AS nameFromLocal,
LOOKUP('dimBaseballTeams', 'teamName', 'teamID', teamID) AS nameFromLookup
Consider a single dimension table with schema:
LOOKUP('billing', 'city', 'customerId', customerId, 'creditHistory', creditHistory) AS lookedupCity
- The data return type of the UDF will be that of the
- when multiple primary key columns are used for the dimension table (e.g. composite primary key), ensure that the order of keys appearing in the lookup() UDF is the same as the order defined in the
primaryKeyColumnsfrom the dimension table schema.