Skip to content

Perf CI: build the report when no query ran on both servers - #129874

Merged
fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:perf-report-no-compared-queries
Nov 16, 2026
Merged

fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:perf-report-no-compared-queries

Conversation

@groeneai

@groeneai groeneai commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #101273
Related: #113575
Related: #128261

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

The performance comparison report is now built when no query ran on both servers, so the Iceberg jobs of a pull request that changes only performance tests no longer fail with Errors while building the report.

Description

Since #128261, a PR that changes only performance tests runs the six Performance Comparison (arm_release, master_head, iceberg_*, N/3) jobs on the changed tests only. When no query of those tests ran on both servers, all six fail with Errors while building the report. and Insert historical data: FileNotFoundError ... report/all-query-metrics.tsv. In the last 7 days this hit 130 runs on 19 PRs, for example:

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=101273&sha=965b8489c351d4649438deb2a58704c75c19f785&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%20iceberg_s3%2C%203%2F3%29

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=113575&sha=73fcf71e32db31bac34230643871c144022c4d9b&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%20iceberg_local%2C%201%2F3%29

analyze_queries in compare.sh computes statistics only for queries measured on both servers. With none, analyze/query-run-metric-names.tsv is empty, so the scalar subquery over it throws INCORRECT_RESULT_OF_SCALAR_SUBQUERY, and the per-query loop never creates analyze/commands.txt and analyze/query-metric-stats.tsv. report then stops at its first read of the missing query-metric-stats-denorm.tsv, before it writes all-query-metrics.tsv, and Errors while building the report. replaces the per-test errors.

The change creates the two files before the loop, takes any(n) from the names file, which is [] for an empty file, and makes the Total ratio of such a report the neutral -1x instead of +nanx. A normal run writes the same files as before.

Validation: I replayed compare.sh (stage=analyze_queries) in the clickhouse/performance-comparison image on the CI artifacts of #101273, #113575 and #126132, before and after the change. Before, all three reproduce the CI errors. After, report/errors.log is empty: #113575 and #126132 report success, and #101273 reports 20 errors with the hint to add each test to tests/performance/iceberg_skip_list.txt or mark it <test iceberg="0">, because its geo types have no Iceberg equivalent (#128261 fails such a test on purpose). A MergeTree job of #101273 gives the same analysis and report files before and after.


Workflow [PR]
Sync PR [sync-upstream/pr/129874]

Version info

  • Merged into: 26.11.1.2472-master (included in 26.11 and later)

Since ClickHouse#128261 a PR that changes only performance tests runs the Iceberg
jobs on the changed tests only, so often no query is measured on both
servers (the Iceberg rewrite refuses every changed test, only partial
queries, or a skipped test). Then analyze_queries crashed:
query-run-metric-names.tsv is empty, so its scalar subquery throws
INCORRECT_RESULT_OF_SCALAR_SUBQUERY, and the per-query loop never
creates analyze/commands.txt and analyze/query-metric-stats.tsv. The
denorm file was never written, report() stopped at its first read,
before it wrote all-query-metrics.tsv and the other comparison files,
the check said "Errors while building the report." instead of the
per-test errors, and "Insert historical data" failed with
FileNotFoundError.

Create the two files before the loop, the same way confirm_changes
already does for its own files, and take any(n) from the names file:
an aggregate without GROUP BY returns one row, [] for an empty file and
the only row otherwise. The Total ratio of a report with no compared
query is the neutral 1x instead of nan, as for a test whose changes are
all demoted. A run with compared queries writes the same files as
before.

Validated by replaying compare.sh (stage=analyze_queries) in the
performance-comparison image on the CI artifacts of ClickHouse#101273, ClickHouse#113575
and ClickHouse#126132 (before: the CI errors; after: an empty errors.log, and
"20 errors" with the Iceberg rewrite hint for ClickHouse#101273), and on a
MergeTree job of ClickHouse#101273 (same analysis and report files).

Related: ClickHouse#101273

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

groeneai commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (2 rounds, head 5791ccf)
Finding Verdict
⚠️ A report without compared queries showed Total +nanx (avg over zero tests) AGREE, fixed: neutral -1x, same ifNotFinite idiom as the per-test ratio
💡 Comment wrote any() for the function itself (in-tree style rule) AGREE, fixed
💡 Description said report wrote no file before the failure; it writes the thresholds and partial-queries files first AGREE, reworded
💡 Commit message writes report() instead of report, and "crashed" for an exception noted, not blocking

Round 2 (the Total fix): no findings.

@groeneai

groeneai commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Replaying compare.sh with stage=analyze_queries in the clickhouse/performance-comparison image on the CI artifacts of #101273 (iceberg_s3 3/3), #113575 (iceberg_local 1/3) and #126132 (iceberg_s3 2/3) gives the CI errors on every run: Code: 125 INCORRECT_RESULT_OF_SCALAR_SUBQUERY, then Code: 107 ... query-metric-stats-denorm.tsv doesn't exist, and Errors while building the report.
b Root cause explained? With no query measured on both servers, analyze/query-run-metric-names.tsv is empty (the scalar subquery throws) and the per-query loop never creates analyze/commands.txt and analyze/query-metric-stats.tsv, so the denorm file is never written and report() stops at its first read, before it writes all-query-metrics.tsv and the other comparison files.
c Fix matches root cause? Yes. analyze_queries now writes its outputs with zero rows: the two files are created before the loop, and the names scalar takes any(n), which is [] for an empty file. The Total ratio of such a report is the neutral -1x instead of +nanx. No guard in performance_tests.py and no change to the report verdicts.
d Test intent preserved / new tests added? CI script change, so there is no test of the test infrastructure. Validated by the local replay, and this PR's own CI runs every perf job on full batches.
e Both directions demonstrated? Yes. Before: the CI error pair on all three PRs. After: empty report/errors.log everywhere; #113575 and #126132 report success, #101273 reports 20 errors with the Iceberg rewrite hint. With either edit reverted, #101273 fails again (Code 125, or Code 107 on query-metric-stats.tsv).
f Fix is general across code paths? confirm_changes already creates its own files and has no names scalar. report(), report_metrics, report.py and upload_results all ran clean on the empty inputs. Nightly mode includes partial queries, so it is never empty.
g Fix generalizes across inputs (params/datatypes/wrappers)? Covered: zero compared queries with run errors, with partial queries only, and with a skipped test only, plus a normal MergeTree job.
h Backward compatible? (maintainer-approved exception only) Yes. CI script only. On a MergeTree job of #101273 the analysis and report files are the same before and after (all-query-metrics.tsv up to row order).
i Invariants and contracts preserved? Yes. After analyze_queries the denorm file exists, and after report() all-query-metrics.tsv exists, for any number of compared queries. With at least one, the files are unchanged.

Session id: cron:clickhouse-impl-slot-5:20261107-010000

@groeneai

groeneai commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator Author

cc @egor-click, could you review this and add the can be tested label so CI runs? When no query of the changed perf tests ran on both servers, analyze_queries in compare.sh left query-run-metric-names.tsv empty and never created commands.txt/query-metric-stats.tsv, so the Iceberg report failed with Errors while building the report.; this creates the two files up front and reads the names with any(n).

@groeneai groeneai mentioned this pull request Nov 7, 2026
1 task done
@clickhouse-gh

clickhouse-gh Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5791ccf]

Summary: ✅


AI Review

Summary

The change fixes compare.sh report generation when no queries can be compared and gives empty reports a finite, neutral total ratio. Reviewed PR head 5791ccf82c2f93e7f028703208d2252f5487da80, the full discussion, and downstream reporting and upload paths. No actionable findings. Ten focused before-and-after cases covered empty, skipped, partial-only, failed, and normal inputs: the original failures reproduced, patched reports were generated, test failures remained visible, and normal report TSVs matched the baseline apart from row order.

Final Verdict

Status: ✅ Approve

@fm4v

fm4v commented Nov 16, 2026

Copy link
Copy Markdown
Member

@groeneai merged. Investigate why no perf tests run in these PRs. Is it because of Iceberg?
#130699
Open
#131486
Open
#131494
Open
#131552
Open
#131547
Open
#131560
Open
#131699

@groeneai

Copy link
Copy Markdown
Collaborator Author

Yes, it is Iceberg, and the cause is the test each of these PRs adds, not the harness.

The master_head jobs (amd_release, arm_release) ran each PR's new test normally: CIDB has its ::old/::new rows on every head and the dashboard shows it (e.g. https://performance.ci.clickhouse.com/runs?q=131699). Only the six iceberg_* jobs fail. They are scheduled because each PR adds a test with a MergeTree or Memory table (ci/jobs/scripts/workflow_hooks/filter_job.py:196), they run only that test on Iceberg tables, and none of the seven can run there (default.perf_run_errors_v1):

PR Test Error on Iceberg
#130699 sparse_columns_wide_part_read Params with size 1 is not supported
#131486 merge_batch_sorting_queue_dynamic Column json of type JSON has no Iceberg equivalent
#131494 replacing_collapsing_final_overlapping_parts Storage IcebergLocal doesn't support FINAL
#131547 distinct_final_vertical Storage IcebergLocal doesn't support FINAL
#131552 replacing_final_updated_parts Setting 'max_bytes_to_merge_at_max_space_in_pool' cannot be modified for Iceberg storage
#131560 vertical_final_limit_small_part its system.parts check: expected 4 active parts
#131699 if_string_runs the UInt8 conditions are widened to Int32, which if rejects

With no query measured on both servers, the report then failed to build (Errors while building the report.). #129874 fixes only that step, so my CI ledgers on these PRs that named it as the owner were incomplete.

Fix: I will mark each test <test iceberg="0"> in its PR, since they measure MergeTree, merge and if internals that the Iceberg rewrite cannot keep. I will not use the skip list here: tests/performance/iceberg_skip_list.txt is in ICEBERG_PERFORMANCE_PATHS (ci/jobs/scripts/perf/test_discovery.py:160), so a PR that edits it runs the whole Iceberg suite in the six jobs instead of none.

Merged via the queue into ClickHouse:master with commit 1b54a5f Nov 16, 2026
376 of 377 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). manual approve Manual approve required to run CI pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants