Multi-table join
This topic describes how to use the Multi-table Join operator and its usage considerations.
Purpose
The Multi-table Join operator joins multiple data tables based on specified join conditions. It is an advanced version of a two-table join operator and supports various join types across multiple data tables.
Scenarios
Compute Link | Compute engine | Supported |
Offline | MaxCompute | Yes |
Hive | Yes | |
HiveStorage | Yes | |
RDS/MySQL | Yes | |
Spark | Yes |
Instructions
Source nodes
The Multi-table Join operator requires two or more source nodes, also known as input nodes. Each source node is treated as a table. The operator then joins the data from these source nodes.
Primary table
The primary table in the Multi-table Join operator is one of the input nodes. It serves as the base table for joining with other nodes. By default, the system designates the first input node as the primary table. You can set any other node as the primary table.
If you reassign the primary table after configuring join conditions, the existing conditions are deleted.
Connection type
The Multi-table Join operator supports five types of table joins: left outer join, right outer join, full outer join, inner join, and cross join. You can use different join types for different table pairs. For example, you can use an inner join between the primary table (node A) and node B, and a left join between the primary table (node A) and node C.
The five join types are defined as follows:
Left join: Returns all records from the left table and the matched records from the right table.

Right join: Returns all records from the right table and the matched records from the left table.

Full outer join: Returns all records from both the left and right tables. Matched records are combined into a single row.

Inner join: Returns records that have matching values in both tables.

Cross join: If no join condition is specified, it returns the Cartesian product of the two tables. The number of rows in the result is the number of rows in the left table multiplied by the number of rows in the right table. If a join condition is specified, it returns matched records from both tables, which is the same result as an inner join.

1. Join conditions are required for all join types except cross join.
2. RDS/MySQL does not support full outer joins.
3. MaxCompute (ODPS) does not support Cartesian products, which are cross joins without a condition. To perform a Cartesian product, you can enable MapJoin in the operator node configuration and specify the small tables.
Performing a Cartesian product, which is a cross join without a condition, on large data tables can cause data bloat. This leads to a massive result set, increases node execution duration, and consumes significant storage space.
Join conditions
Join conditions specify which fields to use for joining two data tables. A record from one table is joined with a record from another table if the values in the specified join fields are identical. The Multi-table Join operator lets you specify different join conditions for different table pairs. For example, you can specify the condition "A.ID=B.ID" between the primary table (node A) and node B, and the condition "A.NAME=C.NAME" between the primary table (node A) and node C.
Enable MapJoin
When joining a large table with one or more small tables, you can enable MapJoin and explicitly specify the small tables to improve performance.
The MapJoin feature is supported only by the MaxCompute (ODPS) engine. It has no effect on other engines.
Output fields
You can configure the list of fields that the current node outputs to descendant nodes. By default, all fields from all source nodes are included. You can remove fields as needed. If different source nodes have fields with the same name or code, you must manually rename the duplicate fields.