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>
26 lines
4.1 KiB
HTML
26 lines
4.1 KiB
HTML
<a name="mrs_01_2044"></a><a name="mrs_01_2044"></a>
|
|
|
|
<h1 class="topictitle1">Why Are Some Functions Not Available when Another JDBCServer Is Connected?</h1>
|
|
<div id="body1595920223290"><div class="section" id="mrs_01_2044__s5af1d99fb17c464e8cf3065bd9644f17"><h4 class="sectiontitle">Question</h4><p id="mrs_01_2044__a0a9970131adc4a83984641254318b65a">Scenario 1</p>
|
|
<p id="mrs_01_2044__a870010451205471f8439212e936c96f4">I set up permanent functions using the <strong id="mrs_01_2044__a512186e677e54c759c0c49161706ca13">add jar</strong> statement. After Beeline connects to different JDBCServer or JDBCServer is restarted, I have to run the <strong id="mrs_01_2044__a4001e68443964f36a2a583c7d965b4ea">add jar</strong> statement again.</p>
|
|
<div class="fignone" id="mrs_01_2044__fig1260101417514"><span class="figcap"><b>Figure 1 </b>Error information in scenario 1</span><br><span><img id="mrs_01_2044__image166011218135012" src="en-us_image_0000001438709421.png"></span></div>
|
|
<p id="mrs_01_2044__a4429a276f10d40ac83f5fc5c13ace402">Scenario 2</p>
|
|
<p id="mrs_01_2044__ad3cd4d4e5e644542a32bb31accf7b197">The <strong id="mrs_01_2044__a4a6a529aa5d94fd7b4cf6daffc2de8ea">show functions</strong> statement can be used to query functions, but not obtain functions. The reason is that connected JDBC node does not contain jar packages of the corresponding path. However, after I add corresponding <strong id="mrs_01_2044__a51aa3c7a17eb4bcca81b1746f9956379">.jar</strong> packages, the <strong id="mrs_01_2044__a276c522f77b14bc3a3fbb255c2f36dd7">show functions</strong> statement can be used to obtain functions.</p>
|
|
<div class="fignone" id="mrs_01_2044__fb7f62116b93f41d0be6bc23a35cc95ae"><span class="figcap"><b>Figure 2 </b>Error information in scenario 2</span><br><span><img id="mrs_01_2044__i379a450679e84a4eb3275c07f1943630" src="en-us_image_0000001349170953.png"></span></div>
|
|
</div>
|
|
<div class="section" id="mrs_01_2044__s7f057e5433244fbc8683343eaa9cbc70"><h4 class="sectiontitle">Answer</h4><p id="mrs_01_2044__a87f18f3813f34ab4b7472350b673a316">Scenario 1</p>
|
|
<p id="mrs_01_2044__adc5c7232b58e41c696d556896e710781">The <i><b><span class="cmdname" style="font-family:Arial" id="mrs_01_2044__cd115da2d89444919a04e9975ec1dcb39">add jar</span></b></i> statement is used to load jars to the jarClassLoader of the JDBCServer connected currently. The <i><b><span class="cmdname" style="font-family:Arial" id="mrs_01_2044__c78652b489e0b4a198fc4e377cc18305e">add jar</span></b></i> statement is not shared by different JDBCServer. After the JDBCServer restarts, new jarClassLoader is created. So the add jar statement needs to be run again.</p>
|
|
</div>
|
|
<p id="mrs_01_2044__ac9df5423bb75452cbe92f843da1a28e0">There are two methods to add jar packages: You can run the <strong id="mrs_01_2044__b15621134842017">spark-sql --jars /opt/test/two_udfs.jar</strong> statement to add the jar package during the startup of the Spark SQL process; or run the <strong id="mrs_01_2044__b10608181861919">add jar /opt/test/two_udfs.jar</strong> statement to add the jar package after the Spark SQL process is started. Note that the path following the add jar statement can be a local path or an HDFS path.</p>
|
|
<p id="mrs_01_2044__a35b976ef725c40bf929715d374faa28c">Scenario 2</p>
|
|
<p id="mrs_01_2044__a4b554b50c420482c8b46b290351ba21c">The show functions statement is used to obtain all functions in the current database from the external catalog. If functions are used in SQL, thriftJDBC-server loads <strong id="mrs_01_2044__a6129f0e5d84b4f2892a90d00107fb555">.jar</strong> files related to the function.</p>
|
|
<p id="mrs_01_2044__a4ca3889e0cc441c7869b52ec9edfb79d">If <strong id="mrs_01_2044__a59efa378a78746dd82a225755f408d17">.jar</strong> files do not exist, the function cannot obtain corresponding <strong id="mrs_01_2044__aba6a1767cad94af0a705c46defe05c5c">.jar</strong> files. Therefore, the corresponding <strong id="mrs_01_2044__a965de1dd8be3475b8fb890bb26c0da1d">.jar</strong> files need to be added.</p>
|
|
<p id="mrs_01_2044__a31266bc8feaf4b69938eec47eecbb6c1"></p>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_2022.html">Spark SQL and DataFrame</a></div>
|
|
</div>
|
|
</div>
|
|
|