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>
22 lines
3.5 KiB
HTML
22 lines
3.5 KiB
HTML
<a name="mrs_01_0955"></a><a name="mrs_01_0955"></a>
|
|
|
|
<h1 class="topictitle1">Customizing Row Separators</h1>
|
|
<div id="body1590395281733"><div class="section" id="mrs_01_0955__s746a0f8da5ff48c997e22f773be172f5"><h4 class="sectiontitle">Scenario</h4><p id="mrs_01_0955__a193e63516a7d44ee9c7de570bbd848a6">In most cases, a carriage return character is used as the row delimiter in Hive tables stored in text files, that is, the carriage return character is used as the terminator of a row during queries. However, some data files are delimited by special characters, and not a carriage return character.</p>
|
|
<p id="mrs_01_0955__a7e5a1993ccdb4f66bc6c3afcbd3af4ce">MRS Hive allows you to use different characters or character combinations to delimit rows of Hive text data. When creating a table, set <strong id="mrs_01_0955__b162618206519">inputformat</strong> to <strong id="mrs_01_0955__b4854102485116">SpecifiedDelimiterInputFormat</strong>, and set the following parameter before search each time. Then the table data is queried by the specified delimiter.</p>
|
|
<p id="mrs_01_0955__a85fd61e9f767473194a1498268b65a39"><strong id="mrs_01_0955__ac88c05cf35204bcd900104b14ef4f82a">set hive.textinput.record.delimiter='';</strong></p>
|
|
<div class="note" id="mrs_01_0955__nac8824c9738b4d6e94c34374d8a3436b"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="mrs_01_0955__ul1663795141010"><li id="mrs_01_0955__li156376513107">The Hue component of the current version does not support the configuration of multiple separators when files are imported to a Hive table.</li><li id="mrs_01_0955__li1863735171012">This section applies to MRS 3.<em id="mrs_01_0955__i18102346065225">x</em> or later.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="mrs_01_0955__sd4107084360b4fe3950f42d8d59a8ca0"><h4 class="sectiontitle">Procedure</h4><ol id="mrs_01_0955__o3b33e4e409ae450fb63b42b6f3c2fcc6"><li id="mrs_01_0955__la30c598caceb4ce983485cdb72456641"><span>Specify <strong id="mrs_01_0955__b1930011252528">inputFormat</strong> and <strong id="mrs_01_0955__b365629105218">outputFormat</strong> when creating a table.</span><p><p class="litext" id="mrs_01_0955__a456fc6916bb54a0dbbc2952fc098d19f"><strong id="mrs_01_0955__b20268124610521">CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS] </strong><em id="mrs_01_0955__i1121894715212">[db_name.]table_name</em><strong id="mrs_01_0955__b102849108542"> [(</strong><em id="mrs_01_0955__i8391211175420">col_name data_type</em><strong id="mrs_01_0955__b4653101615413"> [COMMENT </strong><em id="mrs_01_0955__i631681785419">col_comment</em><strong id="mrs_01_0955__b536816552">], </strong><em id="mrs_01_0955__i710111913556">...</em><strong id="mrs_01_0955__b7388145514">)] [ROW FORMAT </strong><em id="mrs_01_0955__i11172172675413">row_format</em><strong id="mrs_01_0955__b5630125175413">] STORED AS inputformat 'org.apache.hadoop.hive.contrib.fileformat.SpecifiedDelimiterInputFormat' outputformat 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'</strong></p>
|
|
</p></li><li id="mrs_01_0955__la60c03d0aea64f92a382e73a4f7ecdd8"><span>Specify the delimiter before search.</span><p><p id="mrs_01_0955__ae71c869995844bbda126341c5069d023"><strong id="mrs_01_0955__a8449c1ad62e741528a7936d0fd631c54">set hive.textinput.record.delimiter='!@!'</strong></p>
|
|
<p id="mrs_01_0955__a20ac92d2ad1847919d2893cf9eefc143">Hive will use '!@!' as the row delimiter.</p>
|
|
</p></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_0581.html">Using Hive</a></div>
|
|
</div>
|
|
</div>
|
|
|