forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Yang, Tong <yangtong2@huawei.com> Co-committed-by: Yang, Tong <yangtong2@huawei.com>
56 lines
9.5 KiB
HTML
56 lines
9.5 KiB
HTML
<a name="mrs_01_1138"></a><a name="mrs_01_1138"></a>
|
|
|
|
<h1 class="topictitle1">String Cut</h1>
|
|
<div id="body8662426"><div class="section" id="mrs_01_1138__en-us_topic_0000001173949274_s550d5758fb36471ba57f974caa3b77e4"><h4 class="sectiontitle">Overview</h4><p id="mrs_01_1138__en-us_topic_0000001173949274_ade3675d7d9c84fa595e116ae91210515">The <span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_pa391322817cf4d31afb8b941fb357478"><b>String Cut</b></span> operator cuts existing fields to generate new fields.</p>
|
|
</div>
|
|
<div class="section" id="mrs_01_1138__en-us_topic_0000001173949274_s297bb1b3ed814fe9834a9b4f5a08986f"><h4 class="sectiontitle">Input and Output</h4><ul id="mrs_01_1138__en-us_topic_0000001173949274_u801bee2f1e184ab79ee9eaabf5b8cfe0"><li id="mrs_01_1138__en-us_topic_0000001173949274_l53cab31aa8244e828fea73b780067127">Input: fields to be cut</li><li id="mrs_01_1138__en-us_topic_0000001173949274_le76f8ed901c24b448edee8c8c49eaf36">Output: new fields</li></ul>
|
|
</div>
|
|
<div class="section" id="mrs_01_1138__en-us_topic_0000001173949274_s7ffd8c82c20444fc93d861e10eda05d7"><h4 class="sectiontitle">Parameter Description</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_1138__en-us_topic_0000001173949274_tde5cafb376cd4506b7a211b64c7308d9" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Operator parameter description</caption><thead align="left"><tr id="mrs_01_1138__en-us_topic_0000001173949274_rd274022cd03942b7b0dbdffe350bddc6"><th align="left" class="cellrowborder" valign="top" width="18.37%" id="mcps1.3.3.2.2.6.1.1"><p id="mrs_01_1138__en-us_topic_0000001173949274_a6773a7ed6d9a448d90e865aa9b7a123c">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="54.730000000000004%" id="mcps1.3.3.2.2.6.1.2"><p id="mrs_01_1138__en-us_topic_0000001173949274_aae80f894ee104a86a34b4c848f294d8f">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="7.5200000000000005%" id="mcps1.3.3.2.2.6.1.3"><p id="mrs_01_1138__en-us_topic_0000001173949274_a478ed2aade2c45de94df44f56fe82888">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="9.69%" id="mcps1.3.3.2.2.6.1.4"><p id="mrs_01_1138__en-us_topic_0000001173949274_a2b2ebcf9786540a2a1cc2ebdad01898a">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="9.69%" id="mcps1.3.3.2.2.6.1.5"><p id="mrs_01_1138__en-us_topic_0000001173949274_a08a8be8a96f04e388da0afa5db9b22e8">Default Value</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="mrs_01_1138__en-us_topic_0000001173949274_r3c582ad111c145d3a3a3614ae8d52ceb"><td class="cellrowborder" valign="top" width="18.37%" headers="mcps1.3.3.2.2.6.1.1 "><p id="mrs_01_1138__en-us_topic_0000001173949274_a271533d4646442968d45ff5d17816ea9">Fields to be cut</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="54.730000000000004%" headers="mcps1.3.3.2.2.6.1.2 "><p id="mrs_01_1138__en-us_topic_0000001173949274_aded57e868e4847dbb4d15de7eeac3fbf">Information about a cut field:</p>
|
|
<ul id="mrs_01_1138__en-us_topic_0000001173949274_u6b90534596fe4891a9739b1579fc2543"><li id="mrs_01_1138__en-us_topic_0000001173949274_l09dd0643e77949d7ba1dd3f8ecdc9350"><span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_pba443844b6e14f09b91cba28904edb8a"><b>input field name</b></span>: Names of input fields. Set this parameter to the names of fields generated in the previous conversion step.</li><li id="mrs_01_1138__en-us_topic_0000001173949274_lca4092d22b4649668791a8ae1e62b952"><span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_p8219fc2c34c442dbb8ab88ce4c1b08af"><b>output field name</b></span>: Names of output fields.</li><li id="mrs_01_1138__en-us_topic_0000001173949274_l36a3e1c4967346cc91f3031697f2132e"><span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_p6f97cb96fee54f2ca3de3185392c0d3c"><b>start position</b></span>: Cutting start position, starting from sequence 1.</li><li id="mrs_01_1138__en-us_topic_0000001173949274_ld5b8b9f9e41a4579a1e2f3705d9ba8ae"><span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_p176abdd2596147d4850762dc68c3bf2d"><b>end position</b></span>: Cutting end position. If the length of the cut string cannot be determined, you can set this parameter to -1, indicating the end of a string to be cut.</li><li id="mrs_01_1138__en-us_topic_0000001173949274_ldd3d02e6967d497aaddbc7e81424293b"><span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_p5def2a1aea29419689988d64a2014ebb"><b>output field type</b></span>: Type of output fields.</li><li id="mrs_01_1138__en-us_topic_0000001173949274_ld98024c548ae4d2cb280cdc2d4be5e47"><span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_pec459958de4347bbae81fd5b16f18c1a"><b>output field length</b></span>: Field value length. If the actual field value is excessively long, the value is cut based on the configured length. When <span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_p795979ae6f46414496b2bf33e4c26d83"><b>output field type</b></span> is set to <span class="parmvalue" id="mrs_01_1138__en-us_topic_0000001173949274_p3f979c1e931d4d9aad1de8da56af63dc"><b>CHAR</b></span>, spaces are added to the field value for supplement if the actual field value length is less than the configured length. When <span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_pdead5c373d3c4cbbbe06c84f5e6d798b"><b>output field type</b></span> is set to <span class="parmvalue" id="mrs_01_1138__en-us_topic_0000001173949274_pc7cf3ce45a784c4ea796e39b1c854bb3"><b>VARCHAR</b></span>, no space is added to the field value for supplement if the actual field value length is less than the configured length.</li></ul>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="7.5200000000000005%" headers="mcps1.3.3.2.2.6.1.3 "><p id="mrs_01_1138__en-us_topic_0000001173949274_ac79bb647c1764eadad63b25043c71b05">map</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="9.69%" headers="mcps1.3.3.2.2.6.1.4 "><p id="mrs_01_1138__en-us_topic_0000001173949274_a15d933a360f344f58d1dc6b56cb96909">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="9.69%" headers="mcps1.3.3.2.2.6.1.5 "><p id="mrs_01_1138__en-us_topic_0000001173949274_a48ad14f9e15e4b95be81e067e1c654fc">None</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="mrs_01_1138__en-us_topic_0000001173949274_s20c810e8a2a34f4d99f3be27cbdc9363"><h4 class="sectiontitle">Data Processing Rule</h4><ul id="mrs_01_1138__en-us_topic_0000001173949274_uca3c1d8a885443fe8cf80cc097e14ff9"><li id="mrs_01_1138__en-us_topic_0000001173949274_le1155cc21c4b48efb43af923980d4e3a"><span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_p07abaf4fedd64411be362b60ce8028c0"><b>start position</b></span> and <span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_pbc1393e32bb247b8ac3fc82bee0a198b"><b>end position</b></span> are used to cut the original fields and generate new fields.</li><li id="mrs_01_1138__en-us_topic_0000001173949274_la5cb65ce1f104a77a86e60c319884088">If <span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_p4a26cf07b46448de86e1969c833283f7"><b>end position</b></span> is set to <span class="parmvalue" id="mrs_01_1138__en-us_topic_0000001173949274_p35c6fe0794324714846bdf1d73884ada"><b>-1</b></span>, the end of a string is to be cut. In other cases, the value of <span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_p96103fc708be4fcebe866a80e7097813"><b>end position</b></span> must be greater than the value of <span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_p5b98688612184e3ea23d7c9529ca8805"><b>start position</b></span>.</li><li id="mrs_01_1138__en-us_topic_0000001173949274_ledcaac2779a9488fb7d1d6f5d6593805">If the value of <span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_pf6a1132ccc114dd7b270685173b24929"><b>start position</b></span> or <span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_p94840ce1214f4976b5c1d0c959dc5799"><b>end position</b></span> is greater than the length of the input field, the line will become dirty data.</li></ul>
|
|
</div>
|
|
<div class="section" id="mrs_01_1138__en-us_topic_0000001173949274_s0c30f9c2699044afb88544a4b557f3e5"><h4 class="sectiontitle">Example</h4><p id="mrs_01_1138__en-us_topic_0000001173949274_abe902c33cf1c4a9eade1a3752efb0f06">Use the <span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_p0bbd8c4218a549bdb62d63d861572bb6"><b>CSV File Input</b></span> operator to generate fields A and B.</p>
|
|
<p id="mrs_01_1138__en-us_topic_0000001173949274_a74c420a5f4d64af2b7eacbafb452d404">The following figure shows the source file.</p>
|
|
<pre class="screen" id="mrs_01_1138__screen1483997204312">abcd,product
|
|
FusionInsight,Bigdata</pre>
|
|
<p id="mrs_01_1138__en-us_topic_0000001173949274_aa23f3dd3e5a2483f91f470a21f2d20fb">After configuring the <span class="parmname" id="mrs_01_1138__en-us_topic_0000001173949274_pe3fa0c58d62c4e2ba52ae0b48ef162df"><b>String Cut</b></span> operator, fields C and D are generated.</p>
|
|
<p id="mrs_01_1138__en-us_topic_0000001173949274_a663b9ee3f376405c8bb5c4033ef5e929"><span><img id="mrs_01_1138__en-us_topic_0000001173949274_i637022cdb16a47ccbc1cdf355a09ce71" src="en-us_image_0000001295740272.png"></span></p>
|
|
<p id="mrs_01_1138__en-us_topic_0000001173949274_a32f76ce8664340f1953563e5fd152440">After cutting, the following fields are generated.</p>
|
|
<pre class="screen" id="mrs_01_1138__screen135781636445">abcd,product,abc,prod
|
|
FusionInsight,Bigdata,Fus,Bigd</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_1130.html">Conversion Operators</a></div>
|
|
</div>
|
|
</div>
|
|
|