Merge pull request #59333 from Algunenano/query_run_metric_arrays

Simplify query_run_metric_arrays in perf tests
This commit is contained in:
Alexey Milovidov 2024-01-30 08:10:50 +01:00 committed by GitHub
commit 3ca1e721a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 10 deletions

View File

@ -444,10 +444,10 @@ create view query_logs as
create table query_run_metric_arrays engine File(TSV, 'analyze/query-run-metric-arrays.tsv')
as
with (
-- sumMapState with the list of all keys with 'nan' values. 'nan' is because
-- sumMap removes keys with positive/negative zeros.
-- sumMapState with the list of all keys with nullable '0' values because sumMap removes keys with default values
-- and 0::Nullable != NULL
with (select groupUniqArrayArray(mapKeys(ProfileEvents)) from query_logs) as all_names
select arrayReduce('sumMapState', [(all_names, arrayMap(x->nan, all_names))])
select arrayReduce('sumMapState', [(all_names, arrayMap(x->0::Nullable(Float64), all_names))])
) as all_metrics
select test, query_index, version, query_id,
(finalizeAggregation(
@ -456,14 +456,12 @@ create table query_run_metric_arrays engine File(TSV, 'analyze/query-run-metric-
all_metrics,
arrayReduce('sumMapState',
[(mapKeys(ProfileEvents),
arrayMap(x->toFloat64(x), mapValues(ProfileEvents)))]
arrayMap(x->toNullable(toFloat64(x)), mapValues(ProfileEvents)))]
),
arrayReduce('sumMapState', [(
['client_time', 'server_time', 'memory_usage'],
arrayMap(x->if(x != 0., x, nan), [
toFloat64(query_runs.time),
toFloat64(query_duration_ms / 1000.),
toFloat64(memory_usage)]))])
[toNullable(toFloat64(query_runs.time)), toNullable(toFloat64(query_duration_ms / 1000.)), toNullable(toFloat64(memory_usage))]
)])
]
)) as metrics_tuple).1 metric_names,
arrayMap(x->if(isNaN(x),0,x), metrics_tuple.2) metric_values

View File

@ -118,8 +118,8 @@ then
# far in the future and have unrelated test changes.
base=$(git -C right/ch merge-base pr origin/master)
git -C right/ch diff --name-only "$base" pr -- . | tee all-changed-files.txt
git -C right/ch diff --name-only "$base" pr -- tests/performance | tee changed-test-definitions.txt
git -C right/ch diff --name-only "$base" pr -- :!tests/performance :!docker/test/performance-comparison | tee other-changed-files.txt
git -C right/ch diff --name-only "$base" pr -- tests/performance/*.xml | tee changed-test-definitions.txt
git -C right/ch diff --name-only "$base" pr -- :!tests/performance/*.xml :!docker/test/performance-comparison | tee other-changed-files.txt
fi
# Set python output encoding so that we can print queries with non-ASCII letters.