The Merge Columns component merges two tables by column. If this component is used, the two tables must have the same number of rows. If one of the two tables has partitions, the partitioned table must connect to the second input port.

Configure the component

You can use one of the following methods to configure the Merge Columns component.

Method 1: Configure the component on the pipeline page

After you select the columns to be merged from the left table, the generated result is saved in the specified columns of the right table.Component configurations

Method 2: Use PAI commands

Configure the component parameters by using PAI commands. You can use the SQL Script component to call PAI commands. For more information, see SQL Script.
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;
ParameterRequiredDescriptionDefault value
inputTableNamesYesThe names of two input tables. Separate two table names with a comma (,). No default value
outputTableNameYesThe name of the output table.No default value
selectedColNamesListNoThe columns that are selected from the input tables.
  • Separate the columns in a table with commas (,).
  • Separate the columns of different tables with semicolons (;).
Note If you select all columns in the two tables, the parameter value must be enclosed in double quotation marks ("). Otherwise, the semicolon (;) is processed as the terminator. If all columns in a table are selected, all column names can be omitted, but the semicolons (;) must be retained.
No default value
inputPartitionsInfoListNoThe partitions that are selected from the input tables.
  • Separate the partitions in a table with forward slashes (/).
  • Separate the partitions of different tables with semicolons (;).
Note If you select all partitions, the parameter value must be enclosed in double quotation marks ("). Otherwise, the semicolon (;) is processed as the terminator. If a table is not partitioned, all partition names can be omitted, but the semicolons (;) must be retained.
No default value
autoRenameColNoSpecifies whether to automatically rename the columns in the output table. false
outputTableColNamesNoThe new names of the columns in the output table. If this parameter is not specified, the column names in the original tables are used.
Important If the autoRenameCol parameter is set to true, this parameter is negligible.
No default value
lifecycleNoThe lifecycle of the output table. The value must be a positive integer. No default value
coreNumNoThe number of cores. The value must be a positive integer. This parameter must be used together with the memSizePerCore parameter. Valid values: [1,9999]. Determined by the system
memSizePerCoreNoThe memory size of each core. The value must be a positive integer. Valid values: [1024,64 x 1024]. Unit: MB. Determined by the system

Example

In this example, the following tables are merged:
  • Source Table 1
    Table 1. maple_test_appendcol_basic_input1
    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
    Table 2. maple_test_appendcol_basic_input2
    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 PAI command to merge the columns of the preceding two source tables:
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 following output table is generated.
Table 3. maple_test_appendcol_setOutCol_output
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