Merge multiple tables

Updated at:

This topic describes how to use the Merge Multiple Tables operator.

Use cases

The Merge Multiple Tables operator merges data from multiple tables based on specified alignment fields. This operator is an advanced version of the Two-Table Union operator and supports merging more than two tables.

Scenarios

Compute link

Compute engine

Support

Offline

MaxCompute

Yes

Hive

Yes

HiveStorage

Yes

RDS/MySQL

Yes

Spark

Yes

Usage notes

Source nodes

The Merge Multiple Tables operator requires two or more source nodes. Each source node is an input table. The operator merges the data from these tables.

Alignment fields

You can specify one or more fields from all source nodes to use as alignment fields. The merged result includes all records from the source nodes, aligned by these fields.

For example, assume you have three input nodes: A, B, and C. You set two alignment conditions: "A.ID <=> B.ID <=> C.ID" and "A.NAME <=> B.NAME <=> C.NAME". The figure below shows the default merge result and the result after deduplication on the right.

image

Quick align

To quickly set alignment conditions, click Quick Align. This automatically sets fields with the same name from all source nodes as the alignment fields.

Output fields

The alignment fields automatically become the output fields for the current node and are passed to descendant nodes. You can rename the field names and field codes as needed.

Deduplicate and merge

By default, the Merge Multiple Tables operator does not remove duplicates, and the output includes all records from the source nodes. You can select Deduplicate and merge to filter duplicate records from the output. For an example of the result, see the diagram in the Alignment fields section.