forked from docs/doc-exports
Reviewed-by: gtema <artem.goncharov@gmail.com> Co-authored-by: Yang, Tong <yangtong2@huawei.com> Co-committed-by: Yang, Tong <yangtong2@huawei.com>
117 lines
7.1 KiB
HTML
117 lines
7.1 KiB
HTML
<a name="mrs_02_0090"></a><a name="mrs_02_0090"></a>
|
|
|
|
<h1 class="topictitle1">Obtain the SQL Result</h1>
|
|
<div id="body1564813273439"><div class="section" id="mrs_02_0090__section4408504619327"><h4 class="sectiontitle">Function</h4><p id="mrs_02_0090__p5843728119329">This API is used to obtain results returned after the SQL statements for querying SparkSQL and SparkScript jobs in an MRS cluster are executed.</p>
|
|
</div>
|
|
<div class="section" id="mrs_02_0090__section10186656193217"><h4 class="sectiontitle">URI</h4><ul id="mrs_02_0090__ul2809877319471"><li id="mrs_02_0090__li5177607319471">Format<p id="mrs_02_0090__p592415311406"><a name="mrs_02_0090__li5177607319471"></a><a name="li5177607319471"></a>GET /v2/{project_id}/clusters/{cluster_id}/job-executions/{job_execution_id}/sql-result</p>
|
|
</li><li id="mrs_02_0090__li2957566119471">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_02_0090__table49499141194754" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URI parameter description</caption><thead align="left"><tr id="mrs_02_0090__en-us_topic_0176790808_row33700024194754"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.2.2.2.1.2.4.1.1"><p id="mrs_02_0090__en-us_topic_0176790808_p16571835194812">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.2.2.2.1.2.4.1.2"><p id="mrs_02_0090__en-us_topic_0176790808_p141410194812">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.2.2.1.2.4.1.3"><p id="mrs_02_0090__en-us_topic_0176790808_p11454278194812">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="mrs_02_0090__en-us_topic_0176790808_row39786771142917"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.2.4.1.1 "><p id="mrs_02_0090__en-us_topic_0176790808_p1503055142917">project_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.2.4.1.2 "><p id="mrs_02_0090__en-us_topic_0176790808_p54638598142917">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.2.1.2.4.1.3 "><p id="mrs_02_0090__en-us_topic_0176790808_p63650338142917">Project ID. For details on how to obtain the project ID, see <a href="mrs_02_0011.html">Obtaining a Project ID</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_02_0090__en-us_topic_0176790808_row3457216201210"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.2.4.1.1 "><p id="mrs_02_0090__en-us_topic_0176790808_p194589160122">cluster_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.2.4.1.2 "><p id="mrs_02_0090__en-us_topic_0176790808_p045813165125">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.2.1.2.4.1.3 "><p id="mrs_02_0090__en-us_topic_0176790808_p1845891641218">Cluster ID. For details on how to obtain the cluster ID, see <a href="mrs_02_0091.html#mrs_02_0091__section177891315153619">Obtaining a Cluster ID</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_02_0090__en-us_topic_0176790808_row121835121146"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.2.4.1.1 "><p id="mrs_02_0090__en-us_topic_0176790808_p218419125412">job_execution_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.2.4.1.2 "><p id="mrs_02_0090__en-us_topic_0176790808_p16184161212420">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.2.1.2.4.1.3 "><p id="mrs_02_0090__en-us_topic_0176790808_p121844121440">Job ID. For details on how to obtain the job ID, see <a href="mrs_02_0091.html#mrs_02_0091__section247234143612">Obtaining a Job ID</a>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="mrs_02_0090__section673761354213"><h4 class="sectiontitle">Request</h4><p id="mrs_02_0090__p1842961591514"><strong id="mrs_02_0090__b19722458154010">Request parameters</strong></p>
|
|
<p id="mrs_02_0090__p106160258151">None</p>
|
|
</div>
|
|
<div class="section" id="mrs_02_0090__section775516131425"><h4 class="sectiontitle">Response</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_02_0090__table12040613193927" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Response parameter description</caption><thead align="left"><tr id="mrs_02_0090__en-us_topic_0177065250_row8843854193927"><th align="left" class="cellrowborder" valign="top" width="25.06%" id="mcps1.3.4.2.2.4.1.1"><p id="mrs_02_0090__en-us_topic_0177065250_p45263556193927">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="24.94%" id="mcps1.3.4.2.2.4.1.2"><p id="mrs_02_0090__en-us_topic_0177065250_p1907984993927">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.2.2.4.1.3"><p id="mrs_02_0090__en-us_topic_0177065250_p17473879193927">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="mrs_02_0090__en-us_topic_0177065250_row8387056194027"><td class="cellrowborder" valign="top" width="25.06%" headers="mcps1.3.4.2.2.4.1.1 "><p id="mrs_02_0090__p199501699424">sql-results</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="24.94%" headers="mcps1.3.4.2.2.4.1.2 "><p id="mrs_02_0090__p1949129154215">Object</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.4.1.3 "><p id="mrs_02_0090__p99471893420">SQL statement query result.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="mrs_02_0090__section1210015461189"><h4 class="sectiontitle">Example</h4><ul id="mrs_02_0090__ul1958913536182"><li id="mrs_02_0090__li1558945321814">Example request<pre class="screen" id="mrs_02_0090__screen29712107377">{
|
|
"job_name": "111",
|
|
"job_type": "SparkSql",
|
|
"arguments": [
|
|
"create table src_wordcount (id int,name string);
|
|
show tables;
|
|
insert INTO src_wordcount VALUES (1, 'a');
|
|
insert INTO src_wordcount VALUES (2, 'b');SELECT * FROM src_wordcount;"
|
|
],
|
|
"properties": {}
|
|
}</pre>
|
|
</li><li id="mrs_02_0090__li543710159193">Example response<ul id="mrs_02_0090__ul166884352188"><li id="mrs_02_0090__li618682601816">Example of a successful response<pre class="screen" id="mrs_02_0090__screen181101255143717">{
|
|
"sql_results": {
|
|
"0": [{
|
|
"result": "succeed"
|
|
}],
|
|
"1": [{
|
|
"database": "default",
|
|
"isTemporary": "false",
|
|
"tableName": "src_wordcount"
|
|
}],
|
|
"2": [{
|
|
"result": "succeed"
|
|
}],
|
|
"3": [{
|
|
"result": "succeed"
|
|
}],
|
|
"4": [{
|
|
"name": "a",
|
|
"id": "1"
|
|
}, {
|
|
"name": "b",
|
|
"id": "2"
|
|
}]
|
|
}
|
|
}</pre>
|
|
</li><li id="mrs_02_0090__li1480742111816">Example of a failed response<pre class="screen" id="mrs_02_0090__screen9377651201811">{
|
|
"error_msg": "Failed to collect SQL job results."
|
|
"error_code":"0172"
|
|
}</pre>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="mrs_02_0090__section4391766619434"><h4 class="sectiontitle">Status Code</h4><p id="mrs_02_0090__p1693116917524">For details about status codes, see <a href="mrs_02_0015.html">Status Codes</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_02_0084.html">Job Object APIs (V2)</a></div>
|
|
</div>
|
|
</div>
|
|
|