Merge branch 'master' of github.com:ClickHouse/ClickHouse into fix-union-distinct

This commit is contained in:
flynn 2023-10-23 11:05:16 +00:00
commit 6fa39c8aec
7 changed files with 117 additions and 5 deletions

2
contrib/grpc vendored

@ -1 +1 @@
Subproject commit 48d1d322358658d8ac6d9b284de9f4ad1ac2bc6b
Subproject commit 80e8fd63fef4a8d35c1abe612854f238eadadf0a

View File

@ -380,7 +380,7 @@ build.
### macOS-only: Install with Homebrew
To install ClickHouse using the popular `brew` package manager, follow the instructions listed in the [ClickHouse Homebrew tap](https://github.com/ClickHouse/homebrew-clickhouse).
To install ClickHouse using [homebrew](https://brew.sh/), see [here](https://formulae.brew.sh/cask/clickhouse).
## Launch {#launch}

View File

@ -1144,11 +1144,32 @@ SELECT arrayFold( x,acc -> acc + x*2, [1, 2, 3, 4], toInt64(3)) AS res;
Result:
``` text
┌─arrayFold(lambda(tuple(x, acc), plus(acc, multiply(x, 2))), [1, 2, 3, 4], toInt64(3))─┐
3 │
└───────────────────────────────────────────────────────────────────────────────────────
┌─res─┐
23 │
└─────┘
```
**Example with the Fibonacci sequence**
```sql
SELECT arrayFold( x, acc -> (acc.2, acc.2 + acc.1), range(number), (1::Int64, 0::Int64)).1 AS fibonacci
FROM numbers(1,10);
┌─fibonacci─┐
│ 0 │
│ 1 │
│ 1 │
│ 2 │
│ 3 │
│ 5 │
│ 8 │
│ 13 │
│ 21 │
│ 34 │
└───────────┘
```
## arrayReverse(arr)
Returns an array of the same size as the original array containing the elements in reverse order.

View File

@ -85,3 +85,4 @@
01940_custom_tld_sharding_key
02815_range_dict_no_direct_join
02861_join_on_nullsafe_compare
01019_alter_materialized_view_consistent

View File

@ -0,0 +1,15 @@
1
02901_parallel_replicas_rollup-default Used parallel replicas: true
0 0 0 6
2019 0 0 2
2019 1 0 2
2019 1 5 1
2019 1 15 1
2020 0 0 4
2020 1 0 2
2020 1 5 1
2020 1 15 1
2020 10 0 2
2020 10 5 1
2020 10 15 1
02901_parallel_replicas_rollup2-default Used parallel replicas: true

View File

@ -0,0 +1,74 @@
#!/usr/bin/env bash
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
function were_parallel_replicas_used ()
{
$CLICKHOUSE_CLIENT --query "SYSTEM FLUSH LOGS"
# Not using current_database = '$CLICKHOUSE_DATABASE' as nested parallel queries aren't run with it
$CLICKHOUSE_CLIENT --query "
SELECT
initial_query_id,
concat('Used parallel replicas: ', (countIf(initial_query_id != query_id) != 0)::bool::String) as used
FROM system.query_log
WHERE event_date >= yesterday()
AND initial_query_id = '$1'
GROUP BY initial_query_id
ORDER BY min(event_time_microseconds) ASC
FORMAT TSV"
}
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS nested"
$CLICKHOUSE_CLIENT --query "CREATE TABLE nested (x UInt8) ENGINE = MergeTree ORDER BY () AS Select 1";
query_id="02901_parallel_replicas_rollup-$CLICKHOUSE_DATABASE"
$CLICKHOUSE_CLIENT \
--query_id "${query_id}" \
--max_parallel_replicas 3 \
--prefer_localhost_replica 1 \
--use_hedged_requests 0 \
--cluster_for_parallel_replicas "parallel_replicas" \
--allow_experimental_parallel_reading_from_replicas 1 \
--parallel_replicas_for_non_replicated_merge_tree 1 \
--parallel_replicas_min_number_of_rows_per_replica 0 \
--query "
SELECT 1 FROM nested
GROUP BY 1 WITH ROLLUP
ORDER BY max((SELECT 1 WHERE 0));
";
were_parallel_replicas_used $query_id
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS nested"
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS days"
$CLICKHOUSE_CLIENT --query "
CREATE TABLE days
(
year Int64,
month Int64,
day Int64
)
ENGINE = MergeTree()
ORDER BY year";
$CLICKHOUSE_CLIENT --query "
INSERT INTO days VALUES (2019, 1, 5), (2019, 1, 15), (2020, 1, 5), (2020, 1, 15), (2020, 10, 5), (2020, 10, 15);
";
# Note that we enforce ordering of the final output because it's not guaranteed by GROUP BY ROLLUP, only the values of count() are
query_id="02901_parallel_replicas_rollup2-$CLICKHOUSE_DATABASE"
$CLICKHOUSE_CLIENT \
--query_id "${query_id}" \
--max_parallel_replicas 3 \
--prefer_localhost_replica 1 \
--use_hedged_requests 0 \
--cluster_for_parallel_replicas "parallel_replicas" \
--allow_experimental_parallel_reading_from_replicas 1 \
--parallel_replicas_for_non_replicated_merge_tree 1 \
--parallel_replicas_min_number_of_rows_per_replica 0 \
--query "SELECT * FROM (SELECT year, month, day, count(*) FROM days GROUP BY year, month, day WITH ROLLUP) ORDER BY 1, 2, 3";
were_parallel_replicas_used $query_id
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS days"

View File

@ -1455,6 +1455,7 @@ farmFingerprint
farmHash
fastops
fcoverage
fibonacci
fifo
filesystem
filesystemAvailable