forked from docs/doc-exports
Reviewed-by: Kacur, Michal <michal.kacur@t-systems.com> Co-authored-by: Yang, Tong <yangtong2@huawei.com> Co-committed-by: Yang, Tong <yangtong2@huawei.com>
52 lines
12 KiB
HTML
52 lines
12 KiB
HTML
<a name="mrs_01_24211"></a><a name="mrs_01_24211"></a>
|
|
|
|
<h1 class="topictitle1">Managing UDFs on the Flink Web UI</h1>
|
|
<div id="body32001227"><p id="mrs_01_24211__en-us_topic_0000001173470778_p8060118">You can customize functions to extend SQL statements to meet personalized requirements. These functions are called user-defined functions (UDFs). You can upload and manage UDF JAR files on the Flink web UI and call UDFs when running jobs.</p>
|
|
<p id="mrs_01_24211__en-us_topic_0000001173470778_p4941185654916">Flink supports the following three types of UDFs, as described in <a href="#mrs_01_24211__en-us_topic_0000001173470778_table6945142055011">Table 1</a>.</p>
|
|
|
|
<div class="tablenoborder"><a name="mrs_01_24211__en-us_topic_0000001173470778_table6945142055011"></a><a name="en-us_topic_0000001173470778_table6945142055011"></a><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_24211__en-us_topic_0000001173470778_table6945142055011" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Function classification</caption><thead align="left"><tr id="mrs_01_24211__en-us_topic_0000001173470778_row594682011508"><th align="left" class="cellrowborder" valign="top" width="30.2%" id="mcps1.3.3.2.3.1.1"><p id="mrs_01_24211__en-us_topic_0000001173470778_p4946132015504">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="69.8%" id="mcps1.3.3.2.3.1.2"><p id="mrs_01_24211__en-us_topic_0000001173470778_p149461208505">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="mrs_01_24211__en-us_topic_0000001173470778_row99461208504"><td class="cellrowborder" valign="top" width="30.2%" headers="mcps1.3.3.2.3.1.1 "><p id="mrs_01_24211__en-us_topic_0000001173470778_p594622085015">User-defined Scalar function (UDF)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.8%" headers="mcps1.3.3.2.3.1.2 "><p id="mrs_01_24211__en-us_topic_0000001173470778_p29461520155018">Supports one or more input parameters and returns a single result value. For details, see <a href="mrs_01_24224.html">UDF Java and SQL Examples</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_24211__en-us_topic_0000001173470778_row15946720105016"><td class="cellrowborder" valign="top" width="30.2%" headers="mcps1.3.3.2.3.1.1 "><p id="mrs_01_24211__en-us_topic_0000001173470778_p119465206502">User-defined aggregation function (UDAF)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.8%" headers="mcps1.3.3.2.3.1.2 "><p id="mrs_01_24211__en-us_topic_0000001173470778_p11946202085012">Aggregates multiple records into one value. For details, see <a href="mrs_01_24225.html">UDAF Java and SQL Examples</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_24211__en-us_topic_0000001173470778_row694622011500"><td class="cellrowborder" valign="top" width="30.2%" headers="mcps1.3.3.2.3.1.1 "><p id="mrs_01_24211__en-us_topic_0000001173470778_p994612013509">User-defined table-valued function (UDTF)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.8%" headers="mcps1.3.3.2.3.1.2 "><p id="mrs_01_24211__en-us_topic_0000001173470778_p19946102013509">Supports one or more input parameters and returns multiple rows or columns. For details, see <a href="mrs_01_24227.html">UDTF Java and SQL Examples</a>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="section" id="mrs_01_24211__en-us_topic_0000001173470778_section5532113516262"><h4 class="sectiontitle">Prerequisites</h4><p id="mrs_01_24211__en-us_topic_0000001173470778_p73241940122615">You have prepared a UDF JAR file whose size does not exceed 200 MB.</p>
|
|
</div>
|
|
<div class="section" id="mrs_01_24211__en-us_topic_0000001173470778_section117082071450"><a name="mrs_01_24211__en-us_topic_0000001173470778_section117082071450"></a><a name="en-us_topic_0000001173470778_section117082071450"></a><h4 class="sectiontitle">Uploading a UDF</h4><ol id="mrs_01_24211__en-us_topic_0000001173470778_ol204355271427"><li id="mrs_01_24211__en-us_topic_0000001173470778_li14331275217"><span>Access the Flink web UI. For details, see <a href="mrs_01_24019.html">Accessing the Flink Web UI</a>.</span></li><li id="mrs_01_24211__en-us_topic_0000001173470778_li154352276211"><span>Click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b238214516437">UDF Management</strong>. The <strong id="mrs_01_24211__en-us_topic_0000001173470778_b1427197164313">UDF Management</strong> page is displayed.</span></li><li id="mrs_01_24211__en-us_topic_0000001173470778_li15435127927"><span>Click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b469271210435">Add UDF</strong>. Select and upload the prepared UDF JAR file for <strong id="mrs_01_24211__en-us_topic_0000001173470778_b154025313438">Local .jar File</strong>.</span></li><li id="mrs_01_24211__en-us_topic_0000001173470778_li137117501564"><span>Enter the UDF name and description and click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b8323818174314">OK</strong>.</span><p><div class="note" id="mrs_01_24211__en-us_topic_0000001173470778_note1718015176108"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="mrs_01_24211__en-us_topic_0000001173470778_p518061716103">A maximum of 10 UDF names can be added. <strong id="mrs_01_24211__en-us_topic_0000001173470778_b12719587220">Name</strong> can be customized. <strong id="mrs_01_24211__en-us_topic_0000001173470778_b129403514229">Type</strong> must correspond to the UDF function in the uploaded UDF JAR file.</p>
|
|
</div></div>
|
|
</p></li><li id="mrs_01_24211__en-us_topic_0000001173470778_li1417961418717"><span>In the UDF list, you can view information about all UDFs in the current application.</span></li><li id="mrs_01_24211__en-us_topic_0000001173470778_li176699477327"><span>(Optional) If you need to run or develop a job immediately, configure the job on the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b1380624502313">Job Management</strong> page.</span><p><div class="p" id="mrs_01_24211__en-us_topic_0000001173470778_p3506440133818">Click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b136505734911139">Job Management</strong>. The job management page is displayed.<ul id="mrs_01_24211__en-us_topic_0000001173470778_ul118711122193916"><li id="mrs_01_24211__en-us_topic_0000001173470778_li487262211393">Starting a UDF job: In the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b5321455142416">Operation</strong> column of the UDF job, click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b16901114257">Start</strong>.</li><li id="mrs_01_24211__en-us_topic_0000001173470778_li148721122163916">Developing a UDF job: In the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b3474184310257">Operation</strong> column of the UDF job, click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b14124125712250">Develop</strong>. For details about related parameters, see <a href="mrs_01_24024.html#mrs_01_24024__en-us_topic_0000001173470782_li1375424453411">Creating a Flink SQL job</a>.</li><li id="mrs_01_24211__en-us_topic_0000001173470778_li20362102717399">Stopping a UDF job: In the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b112121346182714">Operation</strong> column of the UDF job, click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b12212846152714">Stop</strong>.</li><li id="mrs_01_24211__en-us_topic_0000001173470778_li10751114973910">Deleting a UDF job: In the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b17131161013282">Operation</strong> column of the UDF job, click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b197189194287">Delete</strong>. Only jobs in the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b168581365280">Stop</strong> state can be deleted.</li><li id="mrs_01_24211__en-us_topic_0000001173470778_li2034710155474">Editing a UDF job: In the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b2195175317284">Operation</strong> column of the UDF job, click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b167862616293">Edit</strong>. Only the description of a job can be modified.</li><li id="mrs_01_24211__en-us_topic_0000001173470778_li1214012191418">Viewing job details: In the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b126810584290">Operation</strong> column of the UDF job, choose <strong id="mrs_01_24211__en-us_topic_0000001173470778_b494411118301">More</strong> > <strong id="mrs_01_24211__en-us_topic_0000001173470778_b35112818304">Job Monitoring</strong>.</li><li id="mrs_01_24211__en-us_topic_0000001173470778_li13496193664212">Performing checkpoint failure recovery: In the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b1718914149327">Operation</strong> column of the UDF job, choose <strong id="mrs_01_24211__en-us_topic_0000001173470778_b1319011443213">More</strong> > <strong id="mrs_01_24211__en-us_topic_0000001173470778_b819071443212">Checkpoint failure recovery</strong> to recover the fault. You can perform checkpoint failure recovery for jobs in the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b36305657311139">Running failed</strong>, <strong id="mrs_01_24211__en-us_topic_0000001173470778_b170630350611139">Running Succeeded</strong>, or <strong id="mrs_01_24211__en-us_topic_0000001173470778_b173404044011139">Stop</strong> state.</li></ul>
|
|
</div>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="mrs_01_24211__en-us_topic_0000001173470778_section146148450149"><h4 class="sectiontitle">Editing a UDF</h4><ol id="mrs_01_24211__en-us_topic_0000001173470778_ol1479358201410"><li id="mrs_01_24211__en-us_topic_0000001173470778_li127919587143"><span>Upload a UDF JAR file. For details, see <a href="#mrs_01_24211__en-us_topic_0000001173470778_section117082071450">Uploading a UDF</a>.</span></li><li id="mrs_01_24211__en-us_topic_0000001173470778_li9812538121619"><span>In the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b1793415017333">Operation</strong> column of the UDF job, click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b287718581334">Edit</strong>. The <strong id="mrs_01_24211__en-us_topic_0000001173470778_b115301311203411">Edit UDF</strong> page is displayed.</span></li><li id="mrs_01_24211__en-us_topic_0000001173470778_li1434121691715"><span>Modify the information and click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b1545101815342">OK</strong>.</span></li></ol>
|
|
</div>
|
|
<div class="section" id="mrs_01_24211__en-us_topic_0000001173470778_section176363662412"><h4 class="sectiontitle">Deleting a UDF</h4><ol id="mrs_01_24211__en-us_topic_0000001173470778_ol125691238192414"><li id="mrs_01_24211__en-us_topic_0000001173470778_li17569143892410"><span>Upload a UDF JAR file. For details, see <a href="#mrs_01_24211__en-us_topic_0000001173470778_section117082071450">Uploading a UDF</a>.</span></li><li id="mrs_01_24211__en-us_topic_0000001173470778_li25696385242"><span>In the <strong id="mrs_01_24211__en-us_topic_0000001173470778_b0288203953414">Operation</strong> column of the UDF job, click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b192931839153411">Delete</strong>. The <strong id="mrs_01_24211__en-us_topic_0000001173470778_b3294039143411">Delete UDF</strong> page is displayed.</span></li><li id="mrs_01_24211__en-us_topic_0000001173470778_li65698382248"><span>Confirm the information about the UDF to be deleted and click <strong id="mrs_01_24211__en-us_topic_0000001173470778_b1196785873412">OK</strong>.</span><p><div class="note" id="mrs_01_24211__en-us_topic_0000001173470778_note19246353122516"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="mrs_01_24211__en-us_topic_0000001173470778_p11246155392518">Only the UDFs that are not used can be deleted.</p>
|
|
</div></div>
|
|
</p></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_24223.html">Managing UDFs</a></div>
|
|
</div>
|
|
</div>
|
|
|