Yang, Tong 6182f91ba8 MRS component operation guide_normal 2.0.38.SP20 version
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>
2022-12-09 14:55:21 +00:00

56 lines
9.6 KiB
HTML

<a name="mrs_01_2370"></a><a name="mrs_01_2370"></a>
<h1 class="topictitle1">Using the SparkSql Editor on the Hue Web UI</h1>
<div id="body1600498004989"><div class="section" id="mrs_01_2370__s9f93d0a70cdc4575b48c96902a562dfe"><h4 class="sectiontitle">Scenario</h4><p id="mrs_01_2370__p7684161264218">You can use Hue to execute SparkSql statements in a cluster on a graphical user interface (GUI).</p>
</div>
<div class="section" id="mrs_01_2370__section20283834527"><h4 class="sectiontitle">Configuring Spark2x</h4><p id="mrs_01_2370__p139851933529">Before using the SparkSql editor, you need to modify the Spark2x configuration.</p>
<ol id="mrs_01_2370__ol85916154537"><li id="mrs_01_2370__li126541914495"><span>Go to the Spark2x configuration page. For details, see <a href="mrs_01_2125.html">Modifying Cluster Service Configuration Parameters</a>.</span></li><li id="mrs_01_2370__li1069612395472"><span>Set the Spark2x multi-instance mode. Search for and modify the following parameters of the Spark2x service:</span><p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_2370__table1069633924716" frame="border" border="1" rules="all"><thead align="left"><tr id="mrs_01_2370__row19696539154717"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.3.2.2.1.1.3.1.1"><p id="mrs_01_2370__p3696123911475">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.3.2.2.1.1.3.1.2"><p id="mrs_01_2370__p1269673974716">Value</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_01_2370__row66965394471"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.1.1.3.1.1 "><p id="mrs_01_2370__p1069663915472">spark.thriftserver.proxy.enabled</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.1.1.3.1.2 "><p id="mrs_01_2370__p1696139104719">false</p>
</td>
</tr>
<tr id="mrs_01_2370__row18696123964717"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.1.1.3.1.1 "><p id="mrs_01_2370__p16696839164717">spark.scheduler.allocation.file</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.2.2.1.1.3.1.2 "><p id="mrs_01_2370__p1169693984715">#{conf_dir}/fairscheduler.xml</p>
</td>
</tr>
</tbody>
</table>
</div>
</p></li><li id="mrs_01_2370__li857311221656"><span>Go to the JDBCServer2x customization page and add the following customized items to the <strong id="mrs_01_2370__b519414247116">spark.core-site.customized.configs</strong> parameter:</span><p><p id="mrs_01_2370__p220112362613">Set <strong id="mrs_01_2370__b3744679123">hadoop.proxyuser.hue.groups</strong> to <strong id="mrs_01_2370__b54701695128">*</strong>.</p>
<p id="mrs_01_2370__p0201183611613">Set <strong id="mrs_01_2370__b346514379122">hadoop.proxyuser.hue.hosts</strong> to <strong id="mrs_01_2370__b18465193710126">*</strong>.</p>
</p></li><li id="mrs_01_2370__li378314452910"><span>Save the configuration and restart the meta and Spark2x services.</span></li></ol>
</div>
<div class="section" id="mrs_01_2370__section151412178472"><h4 class="sectiontitle">Accessing the Editor</h4><ol id="mrs_01_2370__ol44107557145123"><li id="mrs_01_2370__li849515575276"><span>Access the Hue web UI. For details, see <a href="mrs_01_0132.html">Accessing the Hue Web UI</a>.</span></li><li id="mrs_01_2370__li32181645145123"><span>In the navigation tree on the left, click <span><img id="mrs_01_2370__image188071542102916" src="en-us_image_0000001296090532.png"></span> and choose <span class="uicontrol" id="mrs_01_2370__uicontrol10468102964715"><b>SparkSql</b></span>. The <span class="parmname" id="mrs_01_2370__parmname23960182145123"><b>SparkSql</b></span> page is displayed.</span><p><p id="mrs_01_2370__p18668164145123"><span class="parmname" id="mrs_01_2370__parmname16627724125011"><b>SparkSql</b></span> supports the following functions:</p>
<ul id="mrs_01_2370__ul25945359145123"><li id="mrs_01_2370__li8151932145123">Executes and manages SparkSql statements.</li><li id="mrs_01_2370__li58461858145123">Views the SparkSql statements saved by the current user in <strong id="mrs_01_2370__b1103141520118">Saved Queries</strong>.</li><li id="mrs_01_2370__li40165519145123">Queries SparkSql statements executed by the current user in <strong id="mrs_01_2370__b14209425171120">Query History</strong>.</li></ul>
</p></li></ol>
</div>
<div class="section" id="mrs_01_2370__section714371714718"><h4 class="sectiontitle">Executing SparkSql Statements</h4><ol id="mrs_01_2370__ol59674238145244"><li id="mrs_01_2370__li55366463145244"><span>Select a SparkSql database from the <span class="wintitle" id="mrs_01_2370__en-us_topic_0272686976_wintitle396173155119"><b>Database</b></span> drop-down list box. The default database is <span class="parmvalue" id="mrs_01_2370__en-us_topic_0272686976_parmvalue34652220145244"><b>default</b></span>.</span><p><p id="mrs_01_2370__en-us_topic_0272686976_p43434531145244">The system displays all available tables. You can enter a keyword of the table name to search for the desired table.</p>
</p></li><li id="mrs_01_2370__li29724435145244"><span>Click the desired table name. All columns in the table are displayed.</span><p><p id="mrs_01_2370__p55498498145244">Move the cursor to the row of the table and click <span><img id="mrs_01_2370__image64015734710" src="en-us_image_0000001349289861.jpg"></span>. Column details are displayed.</p>
</p></li><li id="mrs_01_2370__li62672328145244"><span>In the SparkSql statement editing area, enter the query statement.</span><p><p id="mrs_01_2370__p51702834145244">Click the triangle next to <span><img id="mrs_01_2370__image1461310445470" src="en-us_image_0000001296090524.jpg"></span> and select <span class="uicontrol" id="mrs_01_2370__uicontrol3661109145244"><b>Explain</b></span>. The editor checks the syntax and execution plan of the entered statements. If the statements have syntax errors, the editor reports <span class="parmvalue" id="mrs_01_2370__parmvalue28114380145244"><b>Error while compiling statement</b></span>.</p>
</p></li><li id="mrs_01_2370__li66282794145244"><span>Click <span><img id="mrs_01_2370__image152120534504" src="en-us_image_0000001295770740.jpg"></span> to execute the SparkSql statement.</span><p><div class="note" id="mrs_01_2370__note52103997145244"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="mrs_01_2370__ul35615494145244"><li id="mrs_01_2370__li6209567145244">If you want to use the entered SparkSql statements again, click <span><img id="mrs_01_2370__image1548910543262" src="en-us_image_0000001348770561.png"></span> to save them.</li><li id="mrs_01_2370__li674754114817">Advanced query configuration:<p id="mrs_01_2370__p574717411482"><a name="mrs_01_2370__li674754114817"></a><a name="li674754114817"></a>Click <span><img id="mrs_01_2370__image4747241154816" src="en-us_image_0000001295930708.png"></span> in the upper right corner to configure information such as files, functions, and settings.</p>
</li><li id="mrs_01_2370__li1174704114814">Viewing the information of shortcut keys:<p id="mrs_01_2370__p374717418489"><a name="mrs_01_2370__li1174704114814"></a><a name="li1174704114814"></a>Click <span><img id="mrs_01_2370__image57471441144817" src="en-us_image_0000001349090373.png"></span> in the upper right corner to view the syntax and keyboard shortcut information.</p>
</li><li id="mrs_01_2370__li61972459145244">To format the SparkSql statement, click the triangle next to <span><img id="mrs_01_2370__image13777122614524" src="en-us_image_0000001348770553.jpg"></span> and select <span class="uicontrol" id="mrs_01_2370__uicontrol7393128145244"><b>Format</b></span>.</li><li id="mrs_01_2370__li34295104145244">To delete an entered SparkSql statement, click the triangle next to <span><img id="mrs_01_2370__image762853195215" src="en-us_image_0000001295770748.jpg"></span> and select <span class="uicontrol" id="mrs_01_2370__uicontrol24450026145244"><b>Clear</b></span>.</li><li id="mrs_01_2370__li1580691217484">Viewing historical records:<p id="mrs_01_2370__p16806151215484"><a name="mrs_01_2370__li1580691217484"></a><a name="li1580691217484"></a>Click <span class="parmname" id="mrs_01_2370__parmname380691204816"><b>Query History</b></span> to view the SparkSql 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></ul>
</div></div>
</p></li></ol>
</div>
<div class="section" id="mrs_01_2370__section17144417174720"><h4 class="sectiontitle">Viewing Execution Results</h4><ol id="mrs_01_2370__ol47679345145312"><li id="mrs_01_2370__li13016201145312"><span>View the execution results below the execution area on <span class="wintitle" id="mrs_01_2370__wintitle138688441281"><b>SparkSql</b></span>. The <span class="wintitle" id="mrs_01_2370__wintitle88511950987"><b>Query History</b></span> tab page is displayed by default.</span></li><li id="mrs_01_2370__li50036947145312"><span>Click a result to view the execution result of the executed statement.</span></li></ol>
</div>
<div class="section" id="mrs_01_2370__section0145617204712"><h4 class="sectiontitle">Managing Query Statements</h4><ol id="mrs_01_2370__ol61171655145335"><li id="mrs_01_2370__li7136121691110"><span>Click <span class="uicontrol" id="mrs_01_2370__uicontrol19280182311195"><b>Saved Queries</b></span>.</span></li><li id="mrs_01_2370__li14253391145335"><span>Click a saved statement. The system automatically adds the statement to the editing area.</span></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_0130.html">Using Hue (MRS 3.x or Later)</a></div>
</div>
</div>