We assume that you have already learned what is described in:
If you want to find the right Joiner for your purposes, see Joiners Comparison.
For information about lookup tables see Chapter 35, Lookup Tables.
General purpose joiner, merges potentionally unsorted data from one data source incoming through the single input port with another data source from lookup table based on a common key.
Component | Same input metadata | Sorted inputs | Slave inputs | Outputs | Output for drivers without slave | Output for slaves without driver | Joining based on equality |
---|---|---|---|---|---|---|---|
LookupJoin | no | no | 1 (virtual) | 1-2 | yes | no | yes |
This is a general purpose joiner used in most common situations. It does not require that the input 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. That 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.
LookupJoin receives data through a single input port and joins it with data from lookup table. Either data source may potentially have different metadata structure.
The joined data is then sent to the first output port. The second output port can optionally be used to capture unmatched master records.
Port type | Number | Required | Description | Metadata |
---|---|---|---|---|
Input | 0 | yes | Master input port | Any |
1 (virtual) | yes | Slave input port | Any | |
Output | 0 | yes | Output port for the joined data | Any |
1 | no | Optional output 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 |
Attribute | Req | Description | Possible values |
---|---|---|---|
Basic | |||
Join key | yes | Key according to which the incoming data flows are joined. See Join key. | |
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 | 1) | Transformation in CTL or Java defined in the graph. | |
Transform URL | 1) | External file defining the transformation in CTL or Java. | |
Transform class | 1) | External transformation class. | |
Transform source charset | Encoding of external file defining the transformation. | ISO-8859-1 (default) | |
Advanced | |||
Free lookup table after finishing | If set to true , lookup table is
emptied after the parsing finishes. | false (default) | true | |
Deprecated | |||
Error actions | Definition of the action that should be performed when the specified transformation returns some 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. |
Legend:
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.
See CTL Scripting Specifics or Java Interfaces for more information.
See also Defining Transformations for detailed information about transformations.
You must define the key that should be used to join the records (Join key). It is a sequence of field names from the input metadata separated by 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 56.7. Join Key for LookupJoin
$first_name;$last_name
This is the master part of fields that should serve to join master records with slave records.
Lookup key should look like this:
$fname;$lname
Corresponding fields will be compared and matching values will serve to join master and slave records.
When you define your join attributes you must specify a transformation that maps fields from input data sources to the output. This can be done using the Transformations tab of the Transform Editor. However, you may find that you are unable to specify more advanced transformations using this easist approach. This is when you need to use CTL scripting.
For detailed information about CloudConnect Transformation Language see Part XI, CTL - CloudConnect Transformation Language. (CTL is a full-fledged, yet simple language that allows you to perform almost any imaginable transformation.)
CTL scripting allows you to specify custom field mapping using the simple CTL scripting language.
All Joiners share the same transformation template which can be found in CTL Templates for Joiners.
If you define your transformation in Java, it must implement the following interface that is common for all Joiners: