Skip to content

Commit 851fea8

Browse files
Merge branch 'master' into json-with-progress
2 parents c55496e + d7cc5e8 commit 851fea8

File tree

116 files changed

+2561
-917
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+2561
-917
lines changed

docs/en/engines/table-engines/integrations/s3queue.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Default value: `0`.
122122

123123
### s3queue_polling_min_timeout_ms {#polling_min_timeout_ms}
124124

125-
Minimal timeout before next polling (in milliseconds).
125+
Specifies the minimum time, in milliseconds, that ClickHouse waits before making the next polling attempt.
126126

127127
Possible values:
128128

@@ -132,7 +132,7 @@ Default value: `1000`.
132132

133133
### s3queue_polling_max_timeout_ms {#polling_max_timeout_ms}
134134

135-
Maximum timeout before next polling (in milliseconds).
135+
Defines the maximum time, in milliseconds, that ClickHouse waits before initiating the next polling attempt.
136136

137137
Possible values:
138138

@@ -142,7 +142,7 @@ Default value: `10000`.
142142

143143
### s3queue_polling_backoff_ms {#polling_backoff_ms}
144144

145-
Polling backoff (in milliseconds).
145+
Determines the additional wait time added to the previous polling interval when no new files are found. The next poll occurs after the sum of the previous interval and this backoff value, or the maximum interval, whichever is lower.
146146

147147
Possible values:
148148

docs/en/engines/table-engines/mergetree-family/aggregatingmergetree.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ The engine inherits from [MergeTree](../../../engines/table-engines/mergetree-fa
1010

1111
You can use `AggregatingMergeTree` tables for incremental data aggregation, including for aggregated materialized views.
1212

13+
You can see an example of how to use the AggregatingMergeTree and Aggregate functions in the below video:
14+
<div class='vimeo-container'>
15+
<iframe width="1030" height="579" src="https://www.youtube.com/embed/pryhI4F_zqQ" title="Aggregation States in ClickHouse" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
16+
</div>
17+
1318
The engine processes all columns with the following types:
1419

1520
## [AggregateFunction](../../../sql-reference/data-types/aggregatefunction.md)

docs/en/operations/system-tables/asynchronous_metrics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Number of threads in the server of the replicas communication protocol (without
211211

212212
The difference in time the thread for calculation of the asynchronous metrics was scheduled to wake up and the time it was in fact, woken up. A proxy-indicator of overall system latency and responsiveness.
213213

214-
### LoadAverage_*N*
214+
### LoadAverage*N*
215215

216216
The whole system load, averaged with exponential smoothing over 1 minute. The load represents the number of threads across all the processes (the scheduling entities of the OS kernel), that are currently running by CPU or waiting for IO, or ready to run but not being scheduled at this point of time. This number includes all the processes, not only clickhouse-server. The number can be greater than the number of CPU cores, if the system is overloaded, and many processes are ready to run but waiting for CPU or IO.
217217

docs/en/sql-reference/aggregate-functions/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ FROM t_null_big
7575
└────────────────────┴─────────────────────┘
7676
```
7777

78-
Also you can use [Tuple](/docs/en/sql-reference/data-types/tuple.md) to work around NULL skipping behavior. The a `Tuple` that contains only a `NULL` value is not `NULL`, so the aggregate functions won't skip that row because of that `NULL` value.
78+
Also you can use [Tuple](/docs/en/sql-reference/data-types/tuple.md) to work around NULL skipping behavior. A `Tuple` that contains only a `NULL` value is not `NULL`, so the aggregate functions won't skip that row because of that `NULL` value.
7979

8080
```sql
8181
SELECT
@@ -110,7 +110,7 @@ GROUP BY v
110110
└──────┴─────────┴──────────┘
111111
```
112112

113-
And here is an example of of first_value with `RESPECT NULLS` where we can see that NULL inputs are respected and it will return the first value read, whether it's NULL or not:
113+
And here is an example of first_value with `RESPECT NULLS` where we can see that NULL inputs are respected and it will return the first value read, whether it's NULL or not:
114114

115115
```sql
116116
SELECT

docs/en/sql-reference/aggregate-functions/reference/any.md

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,67 @@ sidebar_position: 102
55

66
# any
77

8-
Selects the first encountered value of a column, ignoring any `NULL` values.
8+
Selects the first encountered value of a column.
9+
10+
:::warning
11+
As a query can be executed in arbitrary order, the result of this function is non-deterministic.
12+
If you need an arbitrary but deterministic result, use functions [`min`](../reference/min.md) or [`max`](../reference/max.md).
13+
:::
14+
15+
By default, the function never returns NULL, i.e. ignores NULL values in the input column.
16+
However, if the function is used with the `RESPECT NULLS` modifier, it returns the first value reads no matter if NULL or not.
917

1018
**Syntax**
1119

1220
```sql
1321
any(column) [RESPECT NULLS]
1422
```
1523

16-
Aliases: `any_value`, [`first_value`](../reference/first_value.md).
24+
Aliases `any(column)` (without `RESPECT NULLS`)
25+
- `any_value`
26+
- [`first_value`](../reference/first_value.md).
27+
28+
Alias for `any(column) RESPECT NULLS`
29+
- `anyRespectNulls`, `any_respect_nulls`
30+
- `firstValueRespectNulls`, `first_value_respect_nulls`
31+
- `anyValueRespectNulls`, `any_value_respect_nulls`
1732

1833
**Parameters**
19-
- `column`: The column name.
34+
- `column`: The column name.
2035

2136
**Returned value**
2237

23-
:::note
24-
Supports the `RESPECT NULLS` modifier after the function name. Using this modifier will ensure the function selects the first value passed, regardless of whether it is `NULL` or not.
25-
:::
38+
The first value encountered.
2639

2740
:::note
28-
The return type of the function is the same as the input, except for LowCardinality which is discarded. This means that given no rows as input it will return the default value of that type (0 for integers, or Null for a Nullable() column). You might use the `-OrNull` [combinator](../../../sql-reference/aggregate-functions/combinators.md) ) to modify this behaviour.
29-
:::
30-
31-
:::warning
32-
The query can be executed in any order and even in a different order each time, so the result of this function is indeterminate.
33-
To get a determinate result, you can use the [`min`](../reference/min.md) or [`max`](../reference/max.md) function instead of `any`.
41+
The return type of the function is the same as the input, except for LowCardinality which is discarded.
42+
This means that given no rows as input it will return the default value of that type (0 for integers, or Null for a Nullable() column).
43+
You might use the `-OrNull` [combinator](../../../sql-reference/aggregate-functions/combinators.md) ) to modify this behaviour.
3444
:::
3545

3646
**Implementation details**
3747

38-
In some cases, you can rely on the order of execution. This applies to cases when `SELECT` comes from a subquery that uses `ORDER BY`.
48+
In some cases, you can rely on the order of execution.
49+
This applies to cases when `SELECT` comes from a subquery that uses `ORDER BY`.
3950

40-
When a `SELECT` query has the `GROUP BY` clause or at least one aggregate function, ClickHouse (in contrast to MySQL) requires that all expressions in the `SELECT`, `HAVING`, and `ORDER BY` clauses be calculated from keys or from aggregate functions. In other words, each column selected from the table must be used either in keys or inside aggregate functions. To get behavior like in MySQL, you can put the other columns in the `any` aggregate function.
51+
When a `SELECT` query has the `GROUP BY` clause or at least one aggregate function, ClickHouse (in contrast to MySQL) requires that all expressions in the `SELECT`, `HAVING`, and `ORDER BY` clauses be calculated from keys or from aggregate functions.
52+
In other words, each column selected from the table must be used either in keys or inside aggregate functions.
53+
To get behavior like in MySQL, you can put the other columns in the `any` aggregate function.
4154

4255
**Example**
4356

4457
Query:
4558

4659
```sql
47-
CREATE TABLE any_nulls (city Nullable(String)) ENGINE=Log;
60+
CREATE TABLE tab (city Nullable(String)) ENGINE=Memory;
4861

49-
INSERT INTO any_nulls (city) VALUES (NULL), ('Amsterdam'), ('New York'), ('Tokyo'), ('Valencia'), (NULL);
62+
INSERT INTO tab (city) VALUES (NULL), ('Amsterdam'), ('New York'), ('Tokyo'), ('Valencia'), (NULL);
5063

51-
SELECT any(city) FROM any_nulls;
64+
SELECT any(city), anyRespectNulls(city) FROM tab;
5265
```
5366

5467
```response
55-
┌─any(city)─┐
56-
│ Amsterdam │
57-
└───────────┘
68+
┌─any(city)─┬─anyRespectNulls(city)─
69+
│ Amsterdam │ ᴺᵁᴸᴸ │
70+
└───────────┴───────────────────────
5871
```

docs/en/sql-reference/aggregate-functions/reference/anylast.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,31 @@ sidebar_position: 105
55

66
# anyLast
77

8-
Selects the last value encountered, ignoring any `NULL` values by default. The result is just as indeterminate as for the [any](../../../sql-reference/aggregate-functions/reference/any.md) function.
8+
Selects the last encountered value of a column.
9+
10+
:::warning
11+
As a query can be executed in arbitrary order, the result of this function is non-deterministic.
12+
If you need an arbitrary but deterministic result, use functions [`min`](../reference/min.md) or [`max`](../reference/max.md).
13+
:::
14+
15+
By default, the function never returns NULL, i.e. ignores NULL values in the input column.
16+
However, if the function is used with the `RESPECT NULLS` modifier, it returns the first value reads no matter if NULL or not.
917

1018
**Syntax**
1119

1220
```sql
1321
anyLast(column) [RESPECT NULLS]
1422
```
1523

16-
**Parameters**
17-
- `column`: The column name.
24+
Alias `anyLast(column)` (without `RESPECT NULLS`)
25+
- [`last_value`](../reference/last_value.md).
1826

19-
:::note
20-
Supports the `RESPECT NULLS` modifier after the function name. Using this modifier will ensure the function selects the last value passed, regardless of whether it is `NULL` or not.
21-
:::
27+
Aliases for `anyLast(column) RESPECT NULLS`
28+
- `anyLastRespectNulls`, `anyLast_respect_nulls`
29+
- `lastValueRespectNulls`, `last_value_respect_nulls`
30+
31+
**Parameters**
32+
- `column`: The column name.
2233

2334
**Returned value**
2435

@@ -29,15 +40,15 @@ Supports the `RESPECT NULLS` modifier after the function name. Using this modifi
2940
Query:
3041

3142
```sql
32-
CREATE TABLE any_last_nulls (city Nullable(String)) ENGINE=Log;
43+
CREATE TABLE tab (city Nullable(String)) ENGINE=Memory;
3344

34-
INSERT INTO any_last_nulls (city) VALUES ('Amsterdam'),(NULL),('New York'),('Tokyo'),('Valencia'),(NULL);
45+
INSERT INTO tab (city) VALUES ('Amsterdam'),(NULL),('New York'),('Tokyo'),('Valencia'),(NULL);
3546

36-
SELECT anyLast(city) FROM any_last_nulls;
47+
SELECT anyLast(city), anyLastRespectNulls(city) FROM tab;
3748
```
3849

3950
```response
40-
┌─anyLast(city)─┐
41-
│ Valencia │
42-
└───────────────┘
51+
┌─anyLast(city)─┬─anyLastRespectNulls(city)─
52+
│ Valencia │ ᴺᵁᴸᴸ │
53+
└───────────────┴───────────────────────────
4354
```

docs/en/sql-reference/functions/type-conversion-functions.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6791,7 +6791,7 @@ parseDateTime(str[, format[, timezone]])
67916791

67926792
**Returned value(s)**
67936793

6794-
Returns DateTime values parsed from input string according to a MySQL style format string.
6794+
Return a [DateTime](../data-types/datetime.md) value parsed from the input string according to a MySQL-style format string.
67956795

67966796
**Supported format specifiers**
67976797

@@ -6840,7 +6840,7 @@ parseDateTimeInJodaSyntax(str[, format[, timezone]])
68406840

68416841
**Returned value(s)**
68426842

6843-
Returns DateTime values parsed from input string according to a Joda style format.
6843+
Return a [DateTime](../data-types/datetime.md) value parsed from the input string according to a Joda-style format string.
68446844

68456845
**Supported format specifiers**
68466846

@@ -6885,7 +6885,8 @@ parseDateTime64(str[, format[, timezone]])
68856885

68866886
**Returned value(s)**
68876887

6888-
Returns [DateTime64](../data-types/datetime64.md) type values parsed from input string according to a MySQL style format string.
6888+
Return a [DateTime64](../data-types/datetime64.md) value parsed from the input string according to a MySQL-style format string.
6889+
The precision of the returned value is 6.
68896890

68906891
## parseDateTime64OrZero
68916892

@@ -6913,7 +6914,8 @@ parseDateTime64InJodaSyntax(str[, format[, timezone]])
69136914

69146915
**Returned value(s)**
69156916

6916-
Returns [DateTime64](../data-types/datetime64.md) type values parsed from input string according to a joda style format string.
6917+
Return a [DateTime64](../data-types/datetime64.md) value parsed from the input string according to a Joda-style format string.
6918+
The precision of the returned value equal to the number of `S` placeholders in the format string (but at most 6).
69176919

69186920
## parseDateTime64InJodaSyntaxOrZero
69196921

docs/en/sql-reference/window-functions/first_value.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ first_value (column_name) [[RESPECT NULLS] | [IGNORE NULLS]]
1515
OVER ([[PARTITION BY grouping_column] [ORDER BY sorting_column]
1616
[ROWS or RANGE expression_to_bound_rows_withing_the_group]] | [window_name])
1717
FROM table_name
18-
WINDOW window_name as ([[PARTITION BY grouping_column] [ORDER BY sorting_column])
18+
WINDOW window_name as ([PARTITION BY grouping_column] [ORDER BY sorting_column])
1919
```
2020

2121
Alias: `any`.
2222

2323
:::note
2424
Using the optional modifier `RESPECT NULLS` after `first_value(column_name)` will ensure that `NULL` arguments are not skipped.
2525
See [NULL processing](../aggregate-functions/index.md/#null-processing) for more information.
26+
27+
Alias: `firstValueRespectNulls`
2628
:::
2729

2830
For more detail on window function syntax see: [Window Functions - Syntax](./index.md/#syntax).
@@ -48,7 +50,7 @@ CREATE TABLE salaries
4850
)
4951
Engine = Memory;
5052

51-
INSERT INTO salaries FORMAT Values
53+
INSERT INTO salaries FORMAT VALUES
5254
('Port Elizabeth Barbarians', 'Gary Chen', 196000, 'F'),
5355
('New Coreystad Archdukes', 'Charles Juarez', 190000, 'F'),
5456
('Port Elizabeth Barbarians', 'Michael Stanley', 100000, 'D'),

docs/en/sql-reference/window-functions/last_value.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Alias: `anyLast`.
2323
:::note
2424
Using the optional modifier `RESPECT NULLS` after `first_value(column_name)` will ensure that `NULL` arguments are not skipped.
2525
See [NULL processing](../aggregate-functions/index.md/#null-processing) for more information.
26+
27+
Alias: `lastValueRespectNulls`
2628
:::
2729

2830
For more detail on window function syntax see: [Window Functions - Syntax](./index.md/#syntax).
@@ -33,7 +35,7 @@ For more detail on window function syntax see: [Window Functions - Syntax](./ind
3335

3436
**Example**
3537

36-
In this example the `last_value` function is used to find the highest paid footballer from a fictional dataset of salaries of Premier League football players.
38+
In this example the `last_value` function is used to find the lowest paid footballer from a fictional dataset of salaries of Premier League football players.
3739

3840
Query:
3941

@@ -48,7 +50,7 @@ CREATE TABLE salaries
4850
)
4951
Engine = Memory;
5052

51-
INSERT INTO salaries FORMAT Values
53+
INSERT INTO salaries FORMAT VALUES
5254
('Port Elizabeth Barbarians', 'Gary Chen', 196000, 'F'),
5355
('New Coreystad Archdukes', 'Charles Juarez', 190000, 'F'),
5456
('Port Elizabeth Barbarians', 'Michael Stanley', 100000, 'D'),

src/AggregateFunctions/AggregateFunctionAnyRespectNulls.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,16 @@ void registerAggregateFunctionsAnyRespectNulls(AggregateFunctionFactory & factor
221221
= {.returns_default_when_only_null = false, .is_order_dependent = true, .is_window_function = true};
222222

223223
factory.registerFunction("any_respect_nulls", {createAggregateFunctionAnyRespectNulls, default_properties_for_respect_nulls});
224-
factory.registerAlias("any_value_respect_nulls", "any_respect_nulls", AggregateFunctionFactory::Case::Insensitive);
224+
factory.registerAlias("anyRespectNulls", "any_respect_nulls", AggregateFunctionFactory::Case::Sensitive);
225225
factory.registerAlias("first_value_respect_nulls", "any_respect_nulls", AggregateFunctionFactory::Case::Insensitive);
226+
factory.registerAlias("firstValueRespectNulls", "any_respect_nulls", AggregateFunctionFactory::Case::Sensitive);
227+
factory.registerAlias("any_value_respect_nulls", "any_respect_nulls", AggregateFunctionFactory::Case::Insensitive);
228+
factory.registerAlias("anyValueRespectNulls", "any_respect_nulls", AggregateFunctionFactory::Case::Sensitive);
226229

227230
factory.registerFunction("anyLast_respect_nulls", {createAggregateFunctionAnyLastRespectNulls, default_properties_for_respect_nulls});
231+
factory.registerAlias("anyLastRespectNulls", "anyLast_respect_nulls", AggregateFunctionFactory::Case::Sensitive);
228232
factory.registerAlias("last_value_respect_nulls", "anyLast_respect_nulls", AggregateFunctionFactory::Case::Insensitive);
233+
factory.registerAlias("lastValueRespectNulls", "anyLast_respect_nulls", AggregateFunctionFactory::Case::Sensitive);
229234

230235
/// Must happen after registering any and anyLast
231236
factory.registerNullsActionTransformation("any", "any_respect_nulls");

0 commit comments

Comments
 (0)