LookupJoin
Short Description
LookupJoin is a general purpose joiner. It merges potentially unsorted records from one data source incoming through the single input port with another data source from a lookup table based on a common key.
LookupJoin
x
x
1 (virtual)
1-2
✓
x
✓
✓
Ports
The joined data is then sent to the first output port. The second output port can optionally be used to capture unmatched master records.
Input
0
✓
Master input port
Any
1 (virtual)
✓
Slave input port
Any
Output
0
✓
Output port for the joined data
Any
1
x
Optional port for master data records without slave matches. (Only if the Join type attribute is set to Inner join
.) This applies only to LookupJoin and DBJoin.
Input 0
Metadata
LookupJoin propagates metadata from the first input port to the second output port and from the second output port to the first input port. The propagation does not change the priority of metadata. LookupJoin has no metadata template. Either data source (input port and lookup table) may potentially have a different metadata structure.
LookupJoin Attributes
ATTRIBUTE
REQ
DESCRIPTION
POSSIBLE VALUES
BASIC
Join key
yes
A key according to which incoming data flows are joined. See Join Key below.
Left outer join
If set to true
, also driver records without corresponding slave are parsed. Otherwise, inner join
is performed.
false (default) | true
Lookup table
yes
ID of the lookup table to be used as the resource of slave records. Number of lookup key fields and their data types must be the same as those of Join key. These fields values are compared and matched records are joined.
Transform
[bl
Transformation in CTL or Java defined in the graph.
Transform URL
[bl
External file defining the transformation in CTL or Java.
Transform class
[bl
External transformation class.
Transform source charset
Encoding of the external file defining the transformation. The default encoding depends on DEFAULT_SOURCE_CODE_CHARSET in defaultProperties.
E.g. UTF-8
ADVANCED
Clear lookup table after finishing
When set to true
, memory caches of the lookup table will be emptied at the end of the execution of this component. This has different effects on different lookup table types.
Simple lookup table and Range lookup table will contain 0 entries after this operation.
For the other lookup table types, this will only erase cached data and therefore make more memory available, but the lookup table will still contain the same entries.
false (default) | true
DEPRECATED
Error actions
Definition of the action that should be performed when the specified transformation returns an Error code. See Return Values of Transformations.
Error log
URL of the file to which error messages for specified Error actions should be written. If not set, they are written to Console.
[1] One of these must be set. These transformation attributes must be specified. Any of these transformation attributes must use a common CTL template for Joiners or implement a RecordTransform
interface.
Details
LookupJoin is a general purpose joiner used in most common situations. It does not require the input to be sorted and is very fast as it is processed in memory.
The data attached to the first input port is called the master, the second data source is called the slave. Its data is considered as if it were coming through the second (virtual) input port. Each master record is matched to the slave record on one or more fields known as the join key. The output is produced by applying a transformation which maps joined inputs to the output.
Slave data is pulled out from a lookup table, so depending on the lookup table the data can be stored in the memory. This also depends on the lookup table type, e.g. Database lookup stores only the values which have already been queried. Master data is not stored in the memory.

Join Key Join key is a sequence of field names from the input metadata separated by a semicolon, colon or pipe. You can define the key in the Edit key wizard.
A counterpart of this Join key of the input metadata is the key of lookup table in lookup tables. It is specified in the lookup table itself.
Example 45. Join Key for LookupJoin
This is the master part of fields that should serve to join master records with slave records.
Lookup key should look like this:
Corresponding fields will be compared and matching values will serve to join master and slave records.
Key Duplicates in Lookup Table If the lookup table allows key duplicates, more output records can be created from a single input record.
Examples
Enrichment of Records Using Data from Lookup Table Given a list of number of customers for particular year per country with metadata fields CountryCode, Customers and Year.
Replace the country code by country name. The list of country codes and corresponding country names is available from lookup table CountryCodeLookup
.
Solution Use the attributes Join Key, Lookup Table and Transform.
Join Key
CountryCode
Lookup Table
CountryCodeLookup
Transform
See the code below
Values found in the lookup table are mapped in the same way as if they came from the second input port. The result records are
The country code CZE
has not been found in the lookup table, so it has been sent unchanged to the second output port if an edge is connected.
Matching Ranges with Range Lookup Table This example shows usage of https://docs.primeur.com/docs/types-of-lookup-tables#range-lookup-table table in LookupJoin.
Records on the first data stream contains groups of accounts. Each group of accounts is defined by the lowest and highest account numbers, e.g. 12300 and 12399.
Data on the second data stream contains account numbers. Match the accounts with groups.
Solution Load the records containing account ranges with LookupTableReaderWriter into Range Lookup Table.
In the next phase, use LookupJoin to match the records from the second data stream.
In LookupJoin set Join Key, Lookup Table, and Transform.
Join Key
accountNumber
Lookup Table
RangeLookupTable0
Transform
Map the fields that are necessary
Best Practices
If the transformation is specified in an external file (with Transform URL), we recommend users to explicitly specify Transform source charset.
See also
Common Properties of Components Specific Attribute Types Common Properties of Joiners Lookup Tables in Cluster Environment Defining Transformations
Last updated