All Products
Search
Document Center

Platform For AI:Merge columns

Last Updated:Apr 01, 2026

The Merge Columns component combines two tables side by side, appending all columns from the second table to the right of the first. The row count stays the same — columns are joined horizontally, not stacked.

Prerequisites

Before you begin, make sure that:

  • Both tables have the same number of rows. If the row counts differ, the component returns an error.

  • If one table has partitions, connect the partitioned table to the second input port. Connecting it to the first port causes the operation to fail.

Configure the component

Use one of the following methods.

Method 1: Configure the component on the pipeline page

After you select the columns to merge from the left table, the result is saved to the specified columns of the right table.

Component configurations

Method 2: Use PAI commands

Pass configuration through the appendColumns PAI command. To call PAI commands in a pipeline, use the SQL Script component.

PAI -name appendColumns
    -project algo_public
    -DinputTableNames=maple_test_appendcol_basic_input1,maple_test_appendcol_basic_input2
    -DoutputTableName=maple_test_appendcol_setOutCol_output
    -DoutputTableColNames=x0,x1,x2,x3,x4,x5,x6,x7,x8,x9;

Parameters

ParameterRequiredDefaultDescription
inputTableNamesYesNames of the two input tables, separated by a comma (,).
outputTableNameYesName of the output table.
selectedColNamesListNoColumns to select from each input table. Separate columns within a table with commas (,); separate the two tables with a semicolon (;). If you select all columns from both tables, wrap the value in double quotation marks (") — otherwise the semicolon is treated as a command terminator. If you select all columns from one table, you can omit its column names but must keep the semicolon.
inputPartitionsInfoListNoPartitions to read from each input table. Separate partitions within a table with forward slashes (/); separate the two tables with a semicolon (;). If you select all partitions, wrap the value in double quotation marks ("). If a table is not partitioned, omit its partition names but keep the semicolon.
autoRenameColNofalseSpecifies whether to automatically rename columns in the output table. When set to true, the outputTableColNames parameter is ignored.
outputTableColNamesNoNew column names for the output table, applied in order. If not specified, the original column names from both tables are used. Ignored when autoRenameCol is true.
lifecycleNoLifecycle of the output table. Must be a positive integer.
coreNumNoSystem defaultNumber of cores to allocate. Must be a positive integer in the range [1, 9999]. Must be set together with memSizePerCore.
memSizePerCoreNoSystem defaultMemory allocated per core, in MB. Must be a positive integer in the range [1024, 65536]. Must be set together with coreNum.

Handle column name conflicts

When both input tables share column names, the output table will contain duplicate column names unless you resolve the conflict. Two options are available:

  • Automatic renaming: Set autoRenameCol=true. PAI assigns unique names automatically. Use this when you don't need control over the output column names.

  • Manual naming: Set outputTableColNames to a comma-separated list of new names covering all output columns. Use this when downstream steps depend on specific column names.

If autoRenameCol=true, any value set for outputTableColNames is ignored.

Example

This example merges the following two tables.

Source table 1: `maple_test_appendcol_basic_input1` (5 columns, 5 rows)

col0:bigintcol1:doublecol2:stringcol3:Datetimecol4:Boolean
100.0aaaa2015-10-01 00:00:00TRUE
111.0aaaa2015-10-01 00:00:00FALSE
122.0aaaa2015-10-01 00:00:00TRUE
133.0aaaa2015-10-01 00:00:00TRUE
144.0aaaa2015-10-01 00:00:00TRUE

Source table 2: `maple_test_appendcol_basic_input2` (5 columns, 5 rows)

col10:bigintcol11:doublecol12:stringcol13:Datetimecol14:Boolean
11010.02aaaa2015-10-01 00:00:00TRUE
11111.02aaaa2015-10-01 00:00:00FALSE
11212.02aaaa2015-10-01 00:00:00TRUE
11313.02aaaa2015-10-01 00:00:00TRUE
11414.02aaaa2015-10-01 00:00:00FALSE

Run the following command to merge the two tables and rename all output columns:

PAI -name appendColumns
    -project algo_public
    -DinputTableNames=maple_test_appendcol_basic_input1,maple_test_appendcol_basic_input2
    -DoutputTableName=maple_test_appendcol_setOutCol_output
    -DoutputTableColNames=x0,x1,x2,x3,x4,x5,x6,x7,x8,x9;

The output table maple_test_appendcol_setOutCol_output contains all 10 columns (x0–x4 from source table 1, x5–x9 from source table 2) and the same 5 rows:

x0x1x2x3x4x5x6x7x8x9
100aaaa2015-10-01 00:00:00true110102aaaa2015-10-01 00:00:00true
111aaaa2015-10-01 00:00:00false111112aaaa2015-10-01 00:00:00false
122aaaa2015-10-01 00:00:00true112122aaaa2015-10-01 00:00:00true
133aaaa2015-10-01 00:00:00true113132aaaa2015-10-01 00:00:00true
144aaaa2015-10-01 00:00:00true114142aaaa2015-10-01 00:00:00false