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>
80 lines
11 KiB
HTML
80 lines
11 KiB
HTML
<a name="dli_08_0069"></a><a name="dli_08_0069"></a>
|
|
|
|
<h1 class="topictitle1">Overview</h1>
|
|
<div id="body8662426"><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796834_en-us_topic_0093946912_a4eb9a9b304ea448e951ef2c47f18f371"><a href="#dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_t1d2230f5adf64b9494b7edf1d891b3c9">Table 1</a> lists the window functions supported by DLI.</p>
|
|
|
|
<div class="tablenoborder"><a name="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_t1d2230f5adf64b9494b7edf1d891b3c9"></a><a name="en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_t1d2230f5adf64b9494b7edf1d891b3c9"></a><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_t1d2230f5adf64b9494b7edf1d891b3c9" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Window functions</caption><thead align="left"><tr id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_r23c7b46042924db198ed693967305d8e"><th align="left" class="cellrowborder" valign="top" width="33.17454501038232%" id="mcps1.3.2.2.4.1.1"><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796834_en-us_topic_0093946912_abfe0d47e35bc4affa014a47155c9bb56">Syntax</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="17.02699401490167%" id="mcps1.3.2.2.4.1.2"><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796834_en-us_topic_0093946912_ac683ec8a51644d5594e147e17be71eb8">Value Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="49.798460974716015%" id="mcps1.3.2.2.4.1.3"><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796834_en-us_topic_0093946912_a511f207accc748b390d97221bc2d70b5">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_0069__en-us_topic_0000001705450221_row12691928135418"><td class="cellrowborder" valign="top" width="33.17454501038232%" headers="mcps1.3.2.2.4.1.1 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a692610bde7b943b7b860fbd81c6ff887">cume_dist()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.02699401490167%" headers="mcps1.3.2.2.4.1.2 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a9dae1c6507764b00b78eff206e14b316">DOUBLE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.798460974716015%" headers="mcps1.3.2.2.4.1.3 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_aef9b7beb8de54b75a5a6780352d4db61">Returns the cumulative distribution, which is equivalent to calculating the proportion of data in the partition that is greater than or equal to, or less than or equal to, the current row.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0069__en-us_topic_0000001705450221_row12691112825419"><td class="cellrowborder" valign="top" width="33.17454501038232%" headers="mcps1.3.2.2.4.1.1 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a72a9b63f54f84c16a8419a20cb82594f">first_value(col)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.02699401490167%" headers="mcps1.3.2.2.4.1.2 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_acfe225ccd85e420c9a6e87102a831dc8">Data type of the argument</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.798460974716015%" headers="mcps1.3.2.2.4.1.3 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_af195fbd757d24c2da2ef2097d42ff7ee">Returns the value of the first data record in a column in a result set.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0069__en-us_topic_0000001705450221_row069111280549"><td class="cellrowborder" valign="top" width="33.17454501038232%" headers="mcps1.3.2.2.4.1.1 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_ad6332056eaa043cfaf5f13088af356b6">last_value(col)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.02699401490167%" headers="mcps1.3.2.2.4.1.2 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_aa0687032b3764a5fa729720a6fb41271">Data type of the argument</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.798460974716015%" headers="mcps1.3.2.2.4.1.3 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a5efa22a929854ce78c81dbf25b4025f9">Returns the value of the last data record from a column.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0069__en-us_topic_0000001705450221_row66911228135417"><td class="cellrowborder" valign="top" width="33.17454501038232%" headers="mcps1.3.2.2.4.1.1 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_af36224c7bdf149cf978ecdbe9e43256a">lag (col,n,DEFAULT)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.02699401490167%" headers="mcps1.3.2.2.4.1.2 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_ac2b3bc45c14f45d094c8191348804834">Data type of the argument</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.798460974716015%" headers="mcps1.3.2.2.4.1.3 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_abf69d38fedfc4abc9547189b6b0c0eba">Returns the value from the <em id="dli_08_0069__en-us_topic_0000001705450221_i68001948135517">n</em>th row preceding the current row. The first argument specifies the column name. The second argument specifies the <em id="dli_08_0069__en-us_topic_0000001705450221_i167875715516">n</em>th row preceding the current row. The configuration of the second argument is optional, and the default argument value is <strong id="dli_08_0069__en-us_topic_0000001705450221_b06792057165519">1</strong> if the argument is not specified. The third argument is set to a default value. If the <em id="dli_08_0069__en-us_topic_0000001705450221_i176801857135512">n</em>th row preceding the current row is <strong id="dli_08_0069__en-us_topic_0000001705450221_b3681357135511">null</strong>, the default value is used. The default value of the third argument is <strong id="dli_08_0069__en-us_topic_0000001705450221_b26821857175515">NULL</strong> if the argument is not specified.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0069__en-us_topic_0000001705450221_row369122845415"><td class="cellrowborder" valign="top" width="33.17454501038232%" headers="mcps1.3.2.2.4.1.1 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a0fbe8e562e8a4a5d86aeb97f9b0c91f5">lead (col,n,DEFAULT)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.02699401490167%" headers="mcps1.3.2.2.4.1.2 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a114d645502d2499fb8047257c7eaeffb">Data type of the argument</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.798460974716015%" headers="mcps1.3.2.2.4.1.3 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_afeeafad905ab4584827321f8ab78552a">Returns the value from the <em id="dli_08_0069__en-us_topic_0000001705450221_i187031847565">n</em>th row following the current row. The first argument specifies the column name. The second argument specifies the <em id="dli_08_0069__en-us_topic_0000001705450221_i105618925618">n</em>th row following the current row. The configuration of the second argument is optional, and the default argument value is <strong id="dli_08_0069__en-us_topic_0000001705450221_b65620917569">1</strong> if the argument is not specified. The third argument is set to a default value. If the <em id="dli_08_0069__en-us_topic_0000001705450221_i20563109155619">n</em>th row following the current row is <strong id="dli_08_0069__en-us_topic_0000001705450221_b19564199185618">null</strong>, the default value is used. The default value of the third argument is <strong id="dli_08_0069__en-us_topic_0000001705450221_b1756549145615">NULL</strong> if the argument is not specified.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0069__en-us_topic_0000001705450221_row369132825419"><td class="cellrowborder" valign="top" width="33.17454501038232%" headers="mcps1.3.2.2.4.1.1 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a2b475a9e53364f829c6bfeae94389da3">percent_rank()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.02699401490167%" headers="mcps1.3.2.2.4.1.2 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a4efbb38f9c8549cc8a17316b23184393">DOUBLE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.798460974716015%" headers="mcps1.3.2.2.4.1.3 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a87550b21ba034bb9a033888fd7e53238">Returns the rank of a value from the column specified by the ORDER BY clause of the window. The return value is a decimal between 0 and 1, which is calculated using (RANK - 1)/(- 1).</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0069__en-us_topic_0000001705450221_row209331816175520"><td class="cellrowborder" valign="top" width="33.17454501038232%" headers="mcps1.3.2.2.4.1.1 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a9ae2ab026a2c4c61b7612ec8bf8b3857">rank()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.02699401490167%" headers="mcps1.3.2.2.4.1.2 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a2708875b3dad47fdb87742a3cf3e42ab">INT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.798460974716015%" headers="mcps1.3.2.2.4.1.3 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a4d0c79e64a4d4f0db5aa4410e045d47b">Returns the rank of a value in a set of values. When multiple values share the same rank, the next rank in the sequence is not consecutive.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0069__en-us_topic_0000001705450221_row10691152875412"><td class="cellrowborder" valign="top" width="33.17454501038232%" headers="mcps1.3.2.2.4.1.1 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_abc933c9e3f234ea099c136299ec7cc4e">row_number() over (order by col_1[,col_2 ...])</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.02699401490167%" headers="mcps1.3.2.2.4.1.2 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_a2555ce46f8d544948a7cb94b99a01e02">INT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="49.798460974716015%" headers="mcps1.3.2.2.4.1.3 "><p id="dli_08_0069__en-us_topic_0000001705450221_en-us_topic_0206796841_en-us_topic_0093946919_ad85d34be37dc4042a000d48e80284f53">Assigns a unique number to each row.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0475.html">Window Functions</a></div>
|
|
</div>
|
|
</div>
|
|
|