forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
58 lines
5.8 KiB
HTML
58 lines
5.8 KiB
HTML
<a name="dli_08_0079"></a><a name="dli_08_0079"></a>
|
|
|
|
<h1 class="topictitle1">Updating Partitioned Table Data (Only OBS Tables Supported)</h1>
|
|
<div id="body8662426"><div class="section" id="dli_08_0079__en-us_topic_0114776173_en-us_topic_0093946988_s961c878200f14a358c5aea6c61a2e797"><h4 class="sectiontitle">Function</h4><p id="dli_08_0079__en-us_topic_0114776173_en-us_topic_0093946988_a16897d215347400b9b4674708e9d6bdc">This statement is used to update the partition information about a table in the Metastore.</p>
|
|
</div>
|
|
<div class="section" id="dli_08_0079__en-us_topic_0114776173_en-us_topic_0093946988_s9997a4a51ee54377b5391ca21cf697ae"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="dli_08_0079__en-us_topic_0114776173_screen1648333311472"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">MSCK</span><span class="w"> </span><span class="n">REPAIR</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="k">table_name</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="dli_08_0079__p67635835412">Or</p>
|
|
<pre class="screen" id="dli_08_0079__screen135881227541">ALTER TABLE table_name RECOVER PARTITIONS;</pre>
|
|
</div>
|
|
<div class="section" id="dli_08_0079__en-us_topic_0114776175_en-us_topic_0093946864_s0c845eb1e41148d79029d4f419b4fc4f"><h4 class="sectiontitle">Keywords</h4><ul id="dli_08_0079__ul85891167229"><li id="dli_08_0079__li145908169227">PARTITIONS: partition information</li><li id="dli_08_0079__li14590101622219">SERDEPROPERTIES: Serde attribute</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_0079__en-us_topic_0114776188_en-us_topic_0093946905_s95436b2cebbc4c34b0e6ca8427d4f1d9"><h4 class="sectiontitle">Parameters</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0079__en-us_topic_0114776188_en-us_topic_0103084433_t2fa8597e0dde4884bd6412ac207ebea8" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters</caption><thead align="left"><tr id="dli_08_0079__en-us_topic_0114776188_en-us_topic_0103084433_r16c75fd8fdbf41c79f9aee82b032351c"><th align="left" class="cellrowborder" valign="top" width="18.759999999999998%" id="mcps1.3.4.2.2.3.1.1"><p id="dli_08_0079__en-us_topic_0114776188_en-us_topic_0103084433_a9dd69379a3f54904a9c510fb817659ad">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="81.24%" id="mcps1.3.4.2.2.3.1.2"><p id="dli_08_0079__en-us_topic_0114776188_en-us_topic_0103084433_a7ede0d62539542baa7e367cf902bf2b2">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_0079__row160712191411"><td class="cellrowborder" valign="top" width="18.759999999999998%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0079__p3608320149">table_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="81.24%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0079__p160812219141">Table name</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0079__row173647290145"><td class="cellrowborder" valign="top" width="18.759999999999998%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0079__p123641229111418">partition_specs</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="81.24%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0079__p636492981417">Partition fields</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0079__row1346183911611"><td class="cellrowborder" valign="top" width="18.759999999999998%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0079__p746133911612">obs_path</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="81.24%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0079__p11461133901617">OBS path</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_08_0079__en-us_topic_0114776173_en-us_topic_0093946988_sa26295793f714ee3b039534eb041370c"><h4 class="sectiontitle">Precautions</h4><ul id="dli_08_0079__en-us_topic_0114776173_ul109818361167"><li id="dli_08_0079__en-us_topic_0114776173_li14982036361">This statement is applied only to partitioned tables. After you manually add partition directories to OBS, run this statement to update the newly added partition information in the metastore. The <strong id="dli_08_0079__b11719719144">SHOW PARTITIONS table_name</strong> statement can be used to query the newly-added partitions.</li><li id="dli_08_0079__en-us_topic_0114776173_li41341139868">The partition directory name must be in the specified format, that is, <strong id="dli_08_0079__b168787818142">tablepath/partition_column_name=partition_column_value</strong>.</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_0079__en-us_topic_0114776173_en-us_topic_0093946988_s274e61991a6f42a08a91263eba85e11b"><h4 class="sectiontitle">Example</h4><p id="dli_08_0079__en-us_topic_0114776173_en-us_topic_0093946988_a4f6f4d22b4ef455b85387da6b25a64cc">Run the following statements to update the partition information about table <strong id="dli_08_0079__en-us_topic_0093946988_b84235270616337">ptable</strong> in the Metastore:</p>
|
|
<div class="codecoloring" codetype="Sql" id="dli_08_0079__en-us_topic_0114776173_screen13940522125911"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">MSCK</span><span class="w"> </span><span class="n">REPAIR</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">ptable</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="dli_08_0079__p996317570548">Or</p>
|
|
<pre class="screen" id="dli_08_0079__screen23131621195515">ALTER TABLE ptable RECOVER PARTITIONS;</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0080.html">Syntax for Partitioning a Table</a></div>
|
|
</div>
|
|
</div>
|
|
|