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>
40 lines
9.6 KiB
HTML
40 lines
9.6 KiB
HTML
<a name="mrs_01_0141"></a><a name="mrs_01_0141"></a>
|
|
|
|
<h1 class="topictitle1">Hive on Hue</h1>
|
|
<div id="body1598413148729"><p id="mrs_01_0141__a3dfe5add7a4447dd84e1e427c8b899f6">Hue provides the Hive GUI management function so that users can query Hive data in GUI mode.</p>
|
|
<div class="section" id="mrs_01_0141__s9c9169711efd4257823c8eba94d8b307"><h4 class="sectiontitle">How to Use Query Editor</h4><p id="mrs_01_0141__p1045514338810">Access the Hue web UI. For details, see <a href="mrs_01_0132.html">Accessing the Hue Web UI</a>.</p>
|
|
<p id="mrs_01_0141__p12338202583114">In the navigation tree on the left, click <span><img id="mrs_01_0141__image188071542102916" src="en-us_image_0000001296250192.png"></span> and choose <span class="uicontrol" id="mrs_01_0141__uicontrol10468102964715"><b>Hive</b></span>. The <span class="parmname" id="mrs_01_0141__parmname23960182145123"><b>Hive</b></span> page is displayed.</p>
|
|
</div>
|
|
<ul id="mrs_01_0141__u952c9c75cc234ec28a31bbbf43bc677a"><li id="mrs_01_0141__l42ef615ca4504ba1b2ead716c9933311">Running Hive HQL statements<p id="mrs_01_0141__ab6e64f2c761a46919a53bd458b06b97b"><a name="mrs_01_0141__l42ef615ca4504ba1b2ead716c9933311"></a><a name="l42ef615ca4504ba1b2ead716c9933311"></a>Select the target database on the left. You can also click <span><img id="mrs_01_0141__id5cbfa55e8e64c428844bc7ec48ca573" src="en-us_image_0000001349090389.png"></span> in the upper right corner and enter the target database name to search for the target database.</p>
|
|
<p id="mrs_01_0141__a1b094b6158fe491e92056c156f2664c7">Enter a Hive HQL statement in the text box and click <span><img id="mrs_01_0141__i63492cad576e42dead1d2ba16d1c813b" src="en-us_image_0000001296090544.png"></span> or press <span class="uicontrol" id="mrs_01_0141__u4f456bdd03ac45cb97d9417b245131b5"><b>Ctrl+Enter</b></span> to run the HQL statement. The execution result is displayed on the <span class="parmname" id="mrs_01_0141__p0103acb89a9f439b923de6c38ebc6e1f"><b>Result</b></span> tab page.</p>
|
|
</li><li id="mrs_01_0141__l33d50d7283a34b9e8bfe01f89be05167">Analyzing Hive HQL statements<p id="mrs_01_0141__abaa8199dd38b49e18c0b662e62670827"><a name="mrs_01_0141__l33d50d7283a34b9e8bfe01f89be05167"></a><a name="l33d50d7283a34b9e8bfe01f89be05167"></a>Select the target database on the left, enter the Hive HQL statement in the text box, and click <span><img id="mrs_01_0141__id5e63e360086414fbab5cc08a2aee019" src="en-us_image_0000001349090393.png"></span> to compile the HQL statement and check whether the statement is correct. The execution result is displayed under the text editing box.</p>
|
|
</li><li id="mrs_01_0141__l16bc9177a96149689fd70f86231e39d8">Saving HQL statements<p id="mrs_01_0141__a1f21c9491fd84312abdf2bb5fc9aa3f2"><a name="mrs_01_0141__l16bc9177a96149689fd70f86231e39d8"></a><a name="l16bc9177a96149689fd70f86231e39d8"></a>Enter the Hive HQL statement in the text box, click <span><img id="mrs_01_0141__image1548910543262" src="en-us_image_0000001349090385.png"></span> in the upper right corner, and enter the name and description. You can view the saved statements on the <span class="parmname" id="mrs_01_0141__p2eae68c402b748738a636d13528021d3"><b>Saved Queries</b></span> tab page.</p>
|
|
</li><li id="mrs_01_0141__lc548243f4fcf46b295d3f0124100888e">Viewing historical records<p id="mrs_01_0141__adb1aba62956b47ecacdfa71294e3877b"><a name="mrs_01_0141__lc548243f4fcf46b295d3f0124100888e"></a><a name="lc548243f4fcf46b295d3f0124100888e"></a>Click <span class="parmname" id="mrs_01_0141__parmname1257422115362"><b>Query History</b></span> to view the HQL running status. You can view the history of all the statements or only the saved statements. If many historical records exist, you can enter keywords in the text box to search for desired records.</p>
|
|
</li><li id="mrs_01_0141__l9f12a7e38ab54086a92829f37c90ac50">Configuring advanced query<p id="mrs_01_0141__a6c28ed937aed4738913a4e83ef2a7d5e"><a name="mrs_01_0141__l9f12a7e38ab54086a92829f37c90ac50"></a><a name="l9f12a7e38ab54086a92829f37c90ac50"></a>Click <span><img id="mrs_01_0141__i56d68520f6854b6d832a2af414444395" src="en-us_image_0000001348770577.png"></span> in the upper right corner to configure the file, function, and settings.</p>
|
|
</li><li id="mrs_01_0141__l96074533fd11425a9ea56138df035fac">Viewing the information of shortcut keys<p id="mrs_01_0141__a5de0d0cac3934222b7b266aade325525"><a name="mrs_01_0141__l96074533fd11425a9ea56138df035fac"></a><a name="l96074533fd11425a9ea56138df035fac"></a>Click <span><img id="mrs_01_0141__i399505b1ae9546dc94a0b11e1ca908d9" src="en-us_image_0000001295930720.png"></span> in the upper right corner to view information about all shortcut keys.</p>
|
|
</li></ul>
|
|
<div class="section" id="mrs_01_0141__sd71c303869ac441398c55ef7b5ccf200"><h4 class="sectiontitle">How to Use Metadata Browser</h4><p id="mrs_01_0141__p936393235416">Access the Hue web UI. For details, see <a href="mrs_01_0132.html">Accessing the Hue Web UI</a>.</p>
|
|
<ul id="mrs_01_0141__u6e49bf15e77b46d8b6e6280902d75119"><li id="mrs_01_0141__le04aa16f50d044ad9529de5c94b3d2b0">Viewing metadata of Hive tables<p id="mrs_01_0141__en-us_topic_0272686980_a64364b5dcfed448983d871e881eeb634"><a name="mrs_01_0141__le04aa16f50d044ad9529de5c94b3d2b0"></a><a name="le04aa16f50d044ad9529de5c94b3d2b0"></a>Click <span><img id="mrs_01_0141__en-us_topic_0272686980_image414013237133" src="en-us_image_0000001295930724.png"></span> in the navigation tree on the left and click a table name. The metadata of the Hive table is displayed.</p>
|
|
</li><li id="mrs_01_0141__l382b3c11a3354a369f9e9292d0d45d00">Managing metadata of Hive tables<p id="mrs_01_0141__en-us_topic_0272686980_p311263742717"><a name="mrs_01_0141__l382b3c11a3354a369f9e9292d0d45d00"></a><a name="l382b3c11a3354a369f9e9292d0d45d00"></a>On the metadata information page of a Hive table:</p>
|
|
<ul id="mrs_01_0141__en-us_topic_0272686980_ul11920125062719"><li id="mrs_01_0141__en-us_topic_0272686980_li726413588272">Click <strong id="mrs_01_0141__en-us_topic_0272686980_b452111142182">Import</strong> in the upper right corner to import data.</li><li id="mrs_01_0141__en-us_topic_0272686980_li13714647112719">Click <span class="uicontrol" id="mrs_01_0141__en-us_topic_0272686980_uicontrol18515191262819"><b>Overview</b></span> to view the location of the table file in the <strong id="mrs_01_0141__en-us_topic_0272686980_b5464131507">PROPERTIES</strong> field.<p id="mrs_01_0141__en-us_topic_0272686980_p103071745204710">View the field information of each column in a Hive table and manually add description information. Note that the added description information is not the field comments in the Hive table.</p>
|
|
</li><li id="mrs_01_0141__en-us_topic_0272686980_li11472828286">Click <span class="uicontrol" id="mrs_01_0141__en-us_topic_0272686980_uicontrol44738212813"><b>Sample</b></span> to browse data.</li></ul>
|
|
</li><li id="mrs_01_0141__lace0c3ea8a674b31a306d25ee0a5dac6">Managing Hive metadata tables<p id="mrs_01_0141__en-us_topic_0272686980_a9670c1752c67416fa36f4ae1ef20bfcf"><a name="mrs_01_0141__lace0c3ea8a674b31a306d25ee0a5dac6"></a><a name="lace0c3ea8a674b31a306d25ee0a5dac6"></a>Click <span><img id="mrs_01_0141__en-us_topic_0272686980_image233915172914" src="en-us_image_0000001295770764.png"></span> in the left list to create a table based on the uploaded file in the database. You can also manually create a table.</p>
|
|
</li></ul>
|
|
<div class="caution" id="mrs_01_0141__note2228538205219"><span class="cautiontitle"><img src="public_sys-resources/caution_3.0-en-us.png"> </span><div class="cautionbody"><p id="mrs_01_0141__en-us_topic_0264266662_p02781117181714">The Hue page is used to view and analyze data such as files and tables. Do not perform high-risk management operations such as deleting objects on the page. If an operation is required, you are advised to perform the operation on each component after confirming that the operation has no impact on services. For example, you can use the HDFS client to perform operations on HDFS files and use the Hive client to perform operations on Hive tables.</p>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="mrs_01_0141__section21332946161447"><h4 class="sectiontitle">Typical Scenarios</h4><p id="mrs_01_0141__p46783883161847">On the Hue page, create a Hive table as follows:</p>
|
|
<ol id="mrs_01_0141__ol40779510153545"><li id="mrs_01_0141__li15709742111253"><span>Click <span><img id="mrs_01_0141__image8766432311" src="en-us_image_0000001296090548.png"></span> at the upper left corner of Hue web UI and select the Hive instance to be operated to enter the Hive command execution page.</span></li><li id="mrs_01_0141__li16888142965815"><span>Enter an HQL statement in the command input box, for example:</span><p><p id="mrs_01_0141__p104511335175811"><strong id="mrs_01_0141__b1845113513588">create table hue_table(id int,name string,company string) row format delimited fields terminated by ',' stored as textfile;</strong></p>
|
|
<p id="mrs_01_0141__p96451932185813">Click <span><img id="mrs_01_0141__image37813493111623" src="en-us_image_0000001349170289.png"></span> to execute the HQL statements.</p>
|
|
</p></li><li id="mrs_01_0141__li471111436588"><span>Enter the following command in the command input box: </span><p><p id="mrs_01_0141__p16127185218586"><strong id="mrs_01_0141__b20172144915815">show tables;</strong></p>
|
|
<p id="mrs_01_0141__p145391855125814">Click <span><img id="mrs_01_0141__image59966609111729" src="en-us_image_0000001296250196.png"></span> to view the created table <strong id="mrs_01_0141__b205945379313">hue_table</strong> in <span class="parmname" id="mrs_01_0141__parmname189390648513"><b>Result</b></span>.</p>
|
|
</p></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_0138.html">Typical Scenarios</a></div>
|
|
</div>
|
|
</div>
|
|
|