Files
doc-exports/docs/dataartsstudio/umn/dataartsstudio_01_0304.html
chenxiaoxiong f9e2808b7c DataArts UMN 20250810 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: chenxiaoxiong <chenxiaoxiong@huawei.com>
Co-committed-by: chenxiaoxiong <chenxiaoxiong@huawei.com>
2025-09-02 10:44:13 +00:00

29 lines
9.7 KiB
HTML

<a name="dataartsstudio_01_0304"></a><a name="dataartsstudio_01_0304"></a>
<h1 class="topictitle1">Adding Fields</h1>
<div id="body8662426"><div class="section" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_section199951935481"><h4 class="sectiontitle">Scenario</h4><ul id="dataartsstudio_01_0304__en-us_topic_0000001570749541_ul4860193210415"><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li586083216416">After job parameters are configured, field mapping needs to be configured. You can customize new fields by clicking <span><img id="dataartsstudio_01_0304__en-us_topic_0000001570749541_image18741959144016" src="en-us_image_0000002269197469.png"></span> on the <strong id="dataartsstudio_01_0304__en-us_topic_0000001570749541_b694615366398">Map Field</strong> page.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li1286003218417">If files are migrated between FTP, SFTP, OBS, and HDFS and the migration source's <span class="parmname" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_parmname19472119474"><b>File Format</b></span> is set to <span class="parmvalue" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_parmvalue139432164716"><b>Binary</b></span>, files will be directly transferred, free from field mapping.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li1186018328415">In other scenarios, CDM automatically maps fields of the source table and the destination table. You need to check whether the mapping and time format are correct. For example, check whether the source field type can be converted into the destination field type.</li></ul>
<div class="p" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_p157117117162">You can click <span><img id="dataartsstudio_01_0304__en-us_topic_0000001570749541_image17711118166" src="en-us_image_0000002234077148.png"></span> on the <strong id="dataartsstudio_01_0304__en-us_topic_0000001570749541_b1820718543399">Map Field</strong> page and select <span class="uicontrol" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_uicontrol3711811181618"><b>Add</b></span> to customize a new field. This field is usually used to mark the database source to ensure the integrity of the data imported to the migration destination.<div class="fignone" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_fig471611101610"><span class="figcap"><b>Figure 1 </b>Field mapping</span><br><span><img id="dataartsstudio_01_0304__en-us_topic_0000001570749541_image136544589578" src="en-us_image_0000002234237032.png" title="Click to enlarge" class="imgResize"></span></div>
</div>
<div class="p" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_p197091111718">Currently, the following field types are supported:<ul id="dataartsstudio_01_0304__en-us_topic_0000001570749541_ul1175281178"><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li1875178201713"><strong id="dataartsstudio_01_0304__en-us_topic_0000001570749541_b29034169455">Constant Parameter</strong><p id="dataartsstudio_01_0304__en-us_topic_0000001570749541_p375178101710">Constant parameters are fixed parameters and do not need to be reconfigured. For example, <span class="parmname" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_parmname197512871719"><b>lable</b></span> = <span class="parmvalue" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_parmvalue47517811716"><b>friends</b></span> is used to identify a constant value.</p>
</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li1375158151712"><strong id="dataartsstudio_01_0304__en-us_topic_0000001570749541_b137518131713">Variables</strong><p id="dataartsstudio_01_0304__en-us_topic_0000001570749541_p7757841712">You can use variables such as time macros, table name macros, and version macros to mark database source information. The variable syntax is ${variable}, where <span class="parmname" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_parmname97520818175"><b>variable</b></span> indicates a variable. For example, <span class="parmname" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_parmname12752813177"><b>input_time</b></span> = <span class="parmvalue" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_parmvalue14751381178"><b>${timestamp()}</b></span> indicates the timestamp of the current time.</p>
</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li177510841714">Expression<p id="dataartsstudio_01_0304__en-us_topic_0000001570749541_p6767814172"><a name="dataartsstudio_01_0304__en-us_topic_0000001570749541_li177510841714"></a><a name="en-us_topic_0000001570749541_li177510841714"></a>You can use the expression language to dynamically generate parameter values based on the running environment. The expression syntax is #{expr}, where <span class="parmname" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_parmname207608161715"><b>expr</b></span> indicates an expression. For example, <span class="parmname" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_parmname076108101710"><b>time</b></span> = <span class="parmvalue" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_parmvalue16764818179"><b>#{DateUtil.now()}</b></span> is used to identify the current date string.</p>
</li></ul>
</div>
</div>
<div class="section" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_section85281359204813"><h4 class="sectiontitle">Constraints</h4><ul id="dataartsstudio_01_0304__en-us_topic_0000001570749541_en-us_topic_0108275458_ul13523111833918"><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_en-us_topic_0108275458_li1365631672">On the <strong id="dataartsstudio_01_0304__en-us_topic_0000001570749541_b1210303374112254">Map Field</strong> tab page, if CDM fails to obtain all columns by obtaining sample values (for example, when data is exported from HBase, CloudTable, or MongoDB, there is a high probability that CDM failed to obtain all columns), you can click <span><img id="dataartsstudio_01_0304__en-us_topic_0000001570749541_en-us_topic_0108275458_image79047469522" src="en-us_image_0000002269116389.png"></span> and select <span class="uicontrol" id="dataartsstudio_01_0304__en-us_topic_0000001570749541_uicontrol503398988112254"><b>Add a new field</b></span> to add new fields to ensure that the data imported to the migration destination is complete.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_en-us_topic_0108275458_li141838319368">When a relational database, Hive, DLI, or MRS Hudi is used as the migration source, sample values cannot be obtained.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_en-us_topic_0108275458_li1193920413558">When SQLServer is the destination, fields of the timestamp type cannot be written. You must change their type (for example, to datetime) so that they can be written.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li1939132873217">Column names are displayed when the source of the migration job is OBS, CSV files are to be migrated, and parameter <strong id="dataartsstudio_01_0304__en-us_topic_0000001570749541_b807359772112254">Extract first row as columns</strong> is set to <strong id="dataartsstudio_01_0304__en-us_topic_0000001570749541_b2141455791112254">Yes</strong>.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_en-us_topic_0108275458_li17558825153711">Field mapping is not involved when the binary format is used to migrate files to files.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li3179183918425">In the automatic table creation scenario, you need to manually add fields to the destination table in advance and then add fields to the field mapping.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li169911629101715">After a field is added, its sample value is not displayed on the console. This does not affect the field value transmission. CDM directly writes the field value to the destination end.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li34536402174">If the field mapping is incorrect, you can adjust the field mapping by dragging fields or clicking <span><img id="dataartsstudio_01_0304__en-us_topic_0000001570749541_image20699140121719" src="en-us_image_0000002234077176.png"></span> to map fields in batches.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_en-us_topic_0108275458_li16330152017146">If the data is imported to DWS, you need to select the distribution columns in the destination fields. You are advised to select the distribution columns according to the following principles:<ol id="dataartsstudio_01_0304__en-us_topic_0000001570749541_ol14406934151211"><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li54061434161211">Use the primary key as the distribution column.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li1240616349125">If multiple data segments are combined as primary keys, specify all primary keys as the distribution column.</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li1840623411120">In the scenario where no primary key is available, if no distribution column is selected, DWS uses the first column as the distribution column by default. As a result, data skew risks exist.</li></ol>
</li><li id="dataartsstudio_01_0304__en-us_topic_0000001570749541_li7109162385916">If a source field type is not supported, convert the field type to a type supported by CDM by referring to <a href="dataartsstudio_01_0209.html">Converting Unsupported Data Types</a>.</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dataartsstudio_01_0110.html">Key Operation Guide</a></div>
</div>
</div>
<script language="JavaScript">
<!--
initImageViewer('.imgResize');
var msg_imageMax = "view original image";
var msg_imageClose = "close";
//--></script>