Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove function listing
  • Loading branch information
huaxingao committed Apr 13, 2020
commit 96aca24a5ddaf01a62fc46ecfc5614f7c562e501
72 changes: 0 additions & 72 deletions docs/sql-ref-functions-builtin-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,78 +24,6 @@ Similarly to aggregate functions, window functions operate on a group of rows. H
* Analytic Functions
* Aggregate Functions

### Types of Window Functions

#### Ranking Functions

<table class="table">
<thead>
<tr><th style="width:25%">Function</th><th>Argument Type(s)</th><th>Description</th></tr>
</thead>
<tr>
<td width="20%"><b> rank </b></td>
<td width="20%"> none </td>
<td width="60%">Returns the rank of rows within a window partition. This is equivalent to the RANK function in SQL. </td>
</tr>
<tr>
<td><b> dense_rank </b></td>
<td> none </td>
<td>Returns the rank of rows within a window partition, without any gaps. This is equivalent to the DENSE_RANK function in SQL.</td>
</tr>
<tr>
<td><b> percent_rank </b></td>
<td> none </td>
<td>Returns the relative rank (i.e. percentile) of rows within a window partition. This is equivalent to the PERCENT_RANK function in SQL.</td>
</tr>
<tr>
<td><b> ntile </b>(<i>n</i>)</td>
<td> Int </td>
<td>Returns the ntile group id (from 1 to `n` inclusive) in an ordered window partition. This is equivalent to the NTILE function in SQL.</td>
</tr>
<tr>
<td><b> row_number </b></td>
<td> none </td>
<td>Returns a sequential number starting from 1 within a window partition. This is equivalent to the ROWNUMBER function in SQL.</td>
</tr>
</table>

#### Analytic Functions

<table class="table">
<thead>
<tr><th style="width:25%">Function</th><th>Argument Type(s)</th><th>Description</th></tr>
</thead>
<tr>
<td width="20%"><b> cume_dist </b></td>
<td width="20%"> none </td>
<td width="60%">Returns the cumulative distribution of values within a window partition, i.e. the fraction of rows that are below the current row. This is equivalent to the CUMEDIST function in SQL. </td>
</tr>
<tr>
<td><b> lag </b>( <i>expression, offset [ , defaultValue ]</i> )</td>
<td> Column, Int [ , Any ]</td>
<td>Returns the value that is <code>offset</code> rows before the current row, and <code>null</code> or <code> defaultValue</code> if there are less than <code>offset</code> rows before the current row.</td>
</tr>
<tr>
<td><b> lag </b>( <i>columnName, offset [ , defaultValue ]</i> )</td>
<td> String, Int [ , Any ]</td>
<td>Returns the value that is <code>offset</code> rows before the current row, and <code>null</code> or <code> defaultValue</code> if there are less than <code>offset</code> rows before the current row.</td>
</tr>
<tr>
<td><b> lead </b>( <i>expression, offset [ , defaultValue ]</i> )</td>
<td> Column, Int [ , Any ] </td>
<td>Returns the value that is <code>offset</code> rows after the current row, and <code>null</code> or <code> defaultValue</code> if there are less than <code>offset</code> rows after the current row. This is equivalent to the LEAD function in SQL.</td>
</tr>
<tr>
<td><b> lead </b>( <i>columnName, offset [ , defaultValue ]</i> )</td>
<td> String, Int [ , Any ] </td>
<td>Returns the value that is <code>offset</code> rows after the current row, and <code>null</code> or <code> defaultValue</code> if there are less than <code>offset</code> rows after the current row. This is equivalent to the LEAD function in SQL.</td>
</tr>
</table>

#### Aggregate Functions

Any of the aggregate functions can be used as a window function. Please refer to the complete list of Spark [Aggregate Functions](sql-ref-functions-builtin-aggregate.html).

### How to Use Window Functions

* Mark a function as window function by using `over`.
Expand Down