mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Update first_value, last_value with possibility to use RESPECT NULLS
This commit is contained in:
parent
e02d14263b
commit
41633cabb2
@ -6,18 +6,25 @@ sidebar_position: 3
|
||||
|
||||
# first_value
|
||||
|
||||
Returns the first non-NULL value evaluated within its ordered frame.
|
||||
Returns the first value evaluated within its ordered frame. By default, NULL arguments are skipped, however the `RESPECT NULLS` modifier can be used to override this behaviour.
|
||||
|
||||
**Syntax**
|
||||
|
||||
```sql
|
||||
first_value (column_name)
|
||||
first_value (column_name) [RESPECT NULLS]
|
||||
OVER ([[PARTITION BY grouping_column] [ORDER BY sorting_column]
|
||||
[ROWS or RANGE expression_to_bound_rows_withing_the_group]] | [window_name])
|
||||
FROM table_name
|
||||
WINDOW window_name as ([[PARTITION BY grouping_column] [ORDER BY sorting_column])
|
||||
```
|
||||
|
||||
Alias: `any`.
|
||||
|
||||
:::note
|
||||
Using the optional modifier `RESPECT NULLS` after `first_value(column_name)` will ensure that `NULL` arguments are not skipped.
|
||||
See [NULL processing](../aggregate-functions/index.md/#null-processing) for more information.
|
||||
:::
|
||||
|
||||
For more detail on window function syntax see: [Window Functions - Syntax](./index.md/#syntax).
|
||||
|
||||
**Returned value**
|
||||
|
@ -77,8 +77,8 @@ WINDOW window_name as ([[PARTITION BY grouping_column] [ORDER BY sorting_column]
|
||||
These functions can be used only as a window function.
|
||||
|
||||
- [`row_number()`](./row_number.md) - Number the current row within its partition starting from 1.
|
||||
- [`first_value(x)`](./first_value.md) - Return the first non-NULL value evaluated within its ordered frame.
|
||||
- [`last_value(x)`](./last_value.md) - Return the last non-NULL value evaluated within its ordered frame.
|
||||
- [`first_value(x)`](./first_value.md) - Return the first value evaluated within its ordered frame.
|
||||
- [`last_value(x)`](./last_value.md) - Return the last value evaluated within its ordered frame.
|
||||
- [`nth_value(x, offset)`](./nth_value.md) - Return the first non-NULL value evaluated against the nth row (offset) in its ordered frame.
|
||||
- [`rank()`](./rank.md) - Rank the current row within its partition with gaps.
|
||||
- [`dense_rank()`](./dense_rank.md) - Rank the current row within its partition without gaps.
|
||||
|
@ -6,18 +6,25 @@ sidebar_position: 4
|
||||
|
||||
# last_value
|
||||
|
||||
Returns the last non-NULL value evaluated within its ordered frame.
|
||||
Returns the last value evaluated within its ordered frame. By default, NULL arguments are skipped, however the `RESPECT NULLS` modifier can be used to override this behaviour.
|
||||
|
||||
**Syntax**
|
||||
|
||||
```sql
|
||||
last_value (column_name)
|
||||
last_value (column_name) [RESPECT NULLS]
|
||||
OVER ([[PARTITION BY grouping_column] [ORDER BY sorting_column]
|
||||
[ROWS or RANGE expression_to_bound_rows_withing_the_group]] | [window_name])
|
||||
FROM table_name
|
||||
WINDOW window_name as ([[PARTITION BY grouping_column] [ORDER BY sorting_column])
|
||||
```
|
||||
|
||||
Alias: `anyLast`.
|
||||
|
||||
:::note
|
||||
Using the optional modifier `RESPECT NULLS` after `first_value(column_name)` will ensure that `NULL` arguments are not skipped.
|
||||
See [NULL processing](../aggregate-functions/index.md/#null-processing) for more information.
|
||||
:::
|
||||
|
||||
For more detail on window function syntax see: [Window Functions - Syntax](./index.md/#syntax).
|
||||
|
||||
**Returned value**
|
||||
|
Loading…
Reference in New Issue
Block a user