Skip to content

Run the performance tests on Iceberg tables - #128261

Merged
fm4v merged 27 commits into
masterfrom
perf-iceberg-config
Nov 3, 2026
Merged

fm4v merged 27 commits into
masterfrom
perf-iceberg-config

Conversation

@fm4v

@fm4v fm4v commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Run the performance tests a second time with their MergeTree tables created as Iceberg tables, so that the same queries measure the Iceberg read and write path, in two backends: IcebergLocal and IcebergS3 (the job-local S3 endpoint).

How it works:

  • perf.py --table-engine iceberg_local|iceberg_s3 rewrites every CREATE TABLE of a MergeTree-family or Memory table among the setup queries (tests/performance/scripts/iceberg_engine.py). The statement is formatted with clickhouse format --oneline of the tested binary first, so the rewrite works on one canonical syntax. The engine becomes IcebergLocal/IcebergS3 with the path perf_iceberg/<test>/<table>/; the leading plain ORDER BY columns stay as the sort order; PARTITION BY, PRIMARY KEY, SAMPLE BY, TTL, SETTINGS, indexes, projections and codecs are dropped; types Iceberg cannot store are widened (UInt8/Int16/... to Int32, UInt64 to Int64 since master rejects UInt64 on CREATE, LowCardinality(T) to T, Enum/FixedString to String, ...). The behavior of ReplacingMergeTree, AggregatingMergeTree and the like is lost (every row is kept); a lightweight UPDATE of a rewritten table becomes an ALTER TABLE ... UPDATE mutation. A column an Iceberg table cannot store even widened (AggregateFunction, JSON, Dynamic, MATERIALIZED, ALIAS) is an error, not a silent skip.
  • Test selection is static: tests with a MergeTree or Memory table in a create_query, minus long tests, <test iceberg="0"> and tests/performance/iceberg_skip_list.txt. That is 270 tests; the skip list has 123, each with its reason. A failure of a test outside the list is a real error. There is deliberately no "skip when it fails on both servers": that would report a regression that breaks Iceberg CREATE/INSERT as a skipped test.
  • The uploaded rows carry arch = 'arm_iceberg_local' / 'arm_iceberg_s3'. The performance tables (query_metrics_v2, the dashboard inputs) and the dashboard filters have no column for the job, so without it the Iceberg rows of a PR would be read by the dashboard gate of its MergeTree shards, and nightly rows would mix with the MergeTree nightly of the same test names. The configuration itself uses no learned thresholds and no dashboard gate.
  • Pull requests: Performance Comparison (arm_release, master_head, iceberg_local|iceberg_s3, N/3), only when the PR changes src/Storages/ObjectStorage/, src/Databases/DataLake/, the Parquet formats or the harness (all the selected tests), or adds or changes a performance test the configuration selects (that test only), with allow_failure until the noise of this configuration is known.
  • Nightly: four jobs in NightlyExtendedPerformance (arm_release, master_head, nightly, iceberg_local|iceberg_s3, N/2), with the same tested and reference binaries as its MergeTree jobs (the reference is the previous night's tested binary). Every query of every selected test, ARM only; the rows are told apart by arch.

Validation: every one of the 281 tests with a plain MergeTree table was run with this rewrite on a local master build (26.11.1.917, fills capped at 8 s, queries at 2 s) and compared with the same test on MergeTree; the skip list is the tests with a new error (39 are rejected by the rewrite itself, 33 fail when run); the first complete CI run added 10 tests that need the CI datasets or fail on assertions about MergeTree internals. An A/A run of perf.py --table-engine iceberg_local against two local master servers (group_by_sundy_li, window_partitions) created, measured and dropped the Iceberg tables on both servers. The iceberg_s3 backend runs for the first time in the CI of this PR, which changes the harness and so runs the Iceberg jobs. The nightly jobs can be tried before merge with gh workflow run NightlyExtendedPerformance --ref perf-iceberg-config (that also runs its MergeTree jobs).

Findings from the sweep, for reference: on 26.8 and 26.9, a UInt32 column of an Iceberg table wraps (4294967295 reads back as -1), fixed in 26.10 by #118596 and not backported. A failed Iceberg CREATE leaves an orphan metadata/ directory on master.

Result comparison: perf.py now digests the result of every SQL query on its prewarm run (on the client for the rows the server sends, on the server with one extra query for FORMAT Null) and lists the queries whose results differ between the servers in a new report table, "Queries with Different Results" (not an error). The result-digest lines in the raw output make results comparable across jobs too, e.g. a test on Iceberg tables with the same test on MergeTree.

Related: #128374

Changelog category (leave one):

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

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

Version info

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

Add an Iceberg configuration of the performance comparison: `perf.py --table-engine iceberg_local|iceberg_s3` creates the plain `MergeTree` tables of a test as `IcebergLocal` or `IcebergS3` tables, so that the same queries measure the Iceberg read and write path. The rewrite is in `tests/performance/scripts/iceberg_engine.py`: it formats each `CREATE TABLE` with `clickhouse format --oneline`, replaces the engine, keeps the leading plain `ORDER BY` columns as the sort order, drops the clauses Iceberg has no equivalent for and widens the column types it cannot store. A table that cannot be converted without changing what the test measures is an error.

The configuration runs the 208 tests with a plain `MergeTree` table in a `create_query`, except `long` tests, `<test iceberg="0">` and `tests/performance/iceberg_skip_list.txt` (73 tests, each with its reason, from a local sweep of every test on a master build).

It runs in pull requests that change the Iceberg, object storage or Parquet code or the harness (`ci-performance` runs it always), not as a gate, and every night in the new `NightlyIcebergPerformance` workflow, which reuses the binary and reference resolution of `NightlyExtendedPerformance`. The uploaded rows carry `arch = 'arm_iceberg_local'` or `'arm_iceberg_s3'`, because the performance tables and the dashboard filters have no column for the job: the history, learned thresholds and dashboard gate of the MergeTree runs do not read them, and this configuration uses none of them.
@clickhouse-gh

clickhouse-gh Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6f6e4e3]

Summary: ✅


AI Review

Summary

The PR adds IcebergLocal and IcebergS3 configurations to performance comparisons and nightly runs, rewrites eligible fixtures, and reports differing query results. Earlier findings are addressed in the current code; the revised job-selection policy is documented. Focused probes passed for escaped random-fixture strings, preserved AS SELECT bodies, server digest row counts, zero and nonfinite floats, and client normalization. No unresolved actionable findings remain.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 30, 2026
Comment thread ci/jobs/performance_tests.py Resolved
Comment thread ci/jobs/performance_tests.py Resolved
Every test the Iceberg configuration selects was run on a master build with the rewrite of `iceberg_engine.py`. The four partition tests run now that `PARTITION BY` is dropped instead of translated; three more tests need an Iceberg feature that is missing (`ALTER ... STATISTICS`, lightweight `UPDATE`, `UInt64` in `CREATE ... AS SELECT`).
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Oct 30, 2026
Comment thread tests/performance/iceberg_skip_list.txt Resolved
praktika runs the jobs with `PYTHONSAFEPATH=1`, so the directory of the script is not on `sys.path` and every test of the Iceberg configuration failed with `ModuleNotFoundError: No module named 'iceberg_engine'`.

https://s3.amazonaws.com/clickhouse-test-reports/PRs/128261/a531824901e8bfeeded71b87cb63f89185114873/pr/performance_comparison_arm_release_master_head_iceberg_local_1_2/report.html
#128261
Comment thread tests/performance/iceberg_skip_list.txt Resolved
fm4v added 6 commits October 31, 2026 02:27
The first complete CI run of the configuration failed these tests the same way on both backends: `CREATE TABLE ... AS hits_10m_single` copies `UInt64` columns (the local sweep had no `hits` datasets), assertions on MergeTree parts or on the CPU slots of a MergeTree read, `timeSeriesIdToGroup` over ids written to Iceberg, and `TRUNCATE`, which data lake engines do not support.

https://s3.amazonaws.com/clickhouse-test-reports/PRs/128261/bb2a0796d01a4c940e09dee6e3b78c9a64d52ce9/pr/performance_comparison_arm_release_master_head_iceberg_local_1_2/report.html
#128261
From the CI run of e1b3517: per test, the geometric mean of the Iceberg / MergeTree ratio of the queries measured in both configurations, for `IcebergLocal` and `IcebergS3`, sorted by slowdown.

https://performance.ci.clickhouse.com/runs/pr-128261-e1b3517dafb90fd7867b9c37fc21256f94d64c79
#128261
…ance tests

`perf.py` digests the result of every SQL query on its prewarm run, so the measured runs are not affected: on the client from the rows the server sends (row count and an order-independent sum of row hashes, floats rounded to 6 significant digits), and for `SELECT ... FORMAT Null` on the server with one more query, `SELECT count(), sum(cityHash64(toString(tuple(*)))) FROM (<query>)`. The digests are `result-digest` lines of the raw output, so they can be compared across jobs as well. Different results of the servers are `result-mismatch` lines and a new report table, "Queries with Different Results", not an error. Tests whose setup generates data with `rand`, `now` and the like, and queries whose result is not deterministic, are not compared.

The Iceberg configuration now writes its settings into the default profile of both servers: a dropped table of an `Atomic` database deletes its Iceberg data in the background with the settings of the global context, so the setting of the query did not apply and a test that dropped and recreated a table found its old data.

Move the Iceberg vs MergeTree comparison to `tests/performance/docs/`.
The previous commit, 9231cfb, contains only the move of the comparison document; this one is the change its message describes: the result digests of `perf.py`, the "Queries with Different Results" report table, and the Iceberg settings in the default profile of both servers.
Comment thread tests/performance/scripts/perf.py Resolved
Comment thread tests/performance/scripts/perf.py Resolved
Comment thread tests/performance/scripts/perf.py Resolved
fm4v added 2 commits October 31, 2026 14:25
A test that creates no MergeTree table would only repeat its MergeTree run. The selection already required a plain `MergeTree` table in a `create_query`, but the nightly prepended `calibration.xml`, which creates none, to the Iceberg jobs too. Now it does not, and `perf.py --table-engine` skips a test without a `create_query`, or whose setup creates no MergeTree table, when it is run directly.
…ration

`perf.py --table-engine` now creates the `Memory` tables and the tables of every MergeTree engine as Iceberg tables, not only the plain `MergeTree` ones: the behavior of `ReplacingMergeTree`, `AggregatingMergeTree` and the like is lost, every inserted row is kept. A lightweight `UPDATE t SET ... WHERE ...` of a rewritten table, in the setup or measured, becomes the mutation `ALTER TABLE t UPDATE ... WHERE ...`, which Iceberg tables support.

The configuration runs 270 tests instead of 200. The skip list was updated from a local run of every newly selected or changed test with `perf.py --table-engine iceberg_local` on master: `alter_select`, `apply_patch_parts_merge`, `apply_patch_parts_steps` and `skip_index_planning_with_patch_parts` run now; 45 new tests are skipped, mostly for `FINAL`, `AggregateFunction` and `QBit` columns and assertions on MergeTree internals. `apply_patch_parts_join` and `apply_patch_parts_join_intersecting` fail because Iceberg compaction rejects the `OVERWRITE` snapshot of the update (`Unsupported snapshot's operation type OVERWRITE` in `OPTIMIZE`).
Comment thread tests/performance/scripts/perf.py Resolved
fm4v added 2 commits November 1, 2026 10:33
…gests

* The XML comment of the generated `users.d/zzz-perf-iceberg.xml` contained `--`, which XML does not allow, so both servers of every Iceberg job failed to start (`SAXParseException: Invalid token`).
* `compare.sh` reruns flagged queries with `--table-engine` too (`CHPC_TABLE_ENGINE`), so a confirmation reruns on the same Iceberg tables.
* A prewarm result is released as soon as its digest is computed, and a result above the digest limit is not kept at all, so the measured runs do not hold it in memory.
* Sampling aggregate functions (`quantile*`, `median*`, `groupArraySample`, ...) are not compared, and a difference is reported only if the old server repeats its own result (one more run, only for a mismatch); otherwise the query is `result-nondeterministic`.
* The server-side digest of `FORMAT Null` rounds float columns to 6 significant digits, as the client-side digest does.
* `Map` entries are sorted by their representation, so keys of different normalized types (an integral and a fractional `Decimal`) do not raise; a digest error makes the query `result-digest-skipped` instead of failing it.

https://s3.amazonaws.com/clickhouse-test-reports/PRs/128261/82e564e1d2d07b8efb4a7cbcb97cdaa5ec175b6e/pr/performance_comparison_arm_release_master_head_iceberg_local_1_2/job.log
#128261
… adds or changes

A new performance test that cannot run on Iceberg tables went unnoticed until the nightly run or the next pull request that changes the Iceberg code. Now a pull request that adds or changes a test the configuration selects runs the Iceberg jobs too, on the changed tests only: a test that breaks the configuration fails in the pull request that adds it. A rewrite error tells the author to add the test with the reason to `tests/performance/iceberg_skip_list.txt` or to mark it `<test iceberg="0">`. The paths of the Iceberg code move to `test_discovery.py`, shared by the job filter and the job.
Comment thread ci/jobs/scripts/perf/test_discovery.py Resolved
Comment thread tests/performance/scripts/perf.py Resolved
Comment thread ci/jobs/performance_tests.py Resolved
272 tests (the configuration now also rewrites `Memory` and all MergeTree-family tables), both backends. Tests whose usual configuration has `Memory` tables are marked: their ratio is mostly the cost of reading Parquet against reading RAM.

https://performance.ci.clickhouse.com/runs/pr-128261-aa299f4c73ba740aabd68bde4871bd377481302e
#128261
Comment thread tests/performance/scripts/perf.py Resolved
@ClickHouse ClickHouse deleted a comment from Jeffrey271991 Nov 2, 2026
@ClickHouse ClickHouse deleted a comment from Jeffrey271991 Nov 2, 2026
…loat rounding, generateRandom

* Test discovery accepts `ENGINE Memory` without `=`, which 18 more tests use; the skip list follows in the next commit.
* `CREATE TABLE ... EMPTY AS SELECT` keeps its `SELECT`: the `AS` inside `EMPTY AS` no longer ends the clause.
* The `ci-performance` label runs all the selected tests in the Iceberg configuration, also in a pull request that changes a test.
* The server-side digest rounds a constant zero, NaN or infinity float without an exception: both branches of `if` are evaluated for a constant, so `log10` now gets 1 for them.
* A setup with `generateRandom` or the `GenerateRandom` engine without a seed generates different data on the servers, so its results are not compared (`parquet_read`, `parquet_read_with_index`, `orc_tuple_field_prune`).
fm4v added 7 commits November 2, 2026 12:45
…Iceberg code

The `ci-performance` label neither runs the Iceberg jobs in a pull request without Iceberg changes, nor makes a pull request that changes only performance tests run all of them: the configuration measures the Iceberg code, so a change elsewhere has nothing to show there.
Instead of a separate `NightlyIcebergPerformance` workflow, its four jobs run in the nightly performance workflow, with the same tested and reference binaries. Their rows stay apart from the MergeTree tests by `arch = 'arm_iceberg_local'` or `'arm_iceberg_s3'`; the docstring of the workflow says how to filter them.
The digest of a `FORMAT Null` statement counted the one row of the server's `count(), sum(...)` answer, so "Queries with Different Results" showed 1 row on both servers for any such query. The server's count and hash now go into the digest as they are, also within a group of statements.
For one validation run of the nightly Iceberg jobs on this branch (`gh workflow run NightlyExtendedPerformance --ref perf-iceberg-config`); reverted in the next commit.
fm4v added 2 commits November 2, 2026 20:04
… generateRandom with escaped quotes

* The rewrite stops looking for table clauses at `AS` / `EMPTY AS`: an `ORDER BY`, `LIMIT` or `SETTINGS` of the `SELECT` ended the saved `AS` clause and was lost, so the Iceberg fixture held different data.
* `generateRandom` counts as seeded only when its structure literal (with its escapes, `\'` and `''`) is followed by a literal number; a seed that cannot be established counts as no seed.
# Conflicts:
#	.github/workflows/pull_request.yml
@fm4v
fm4v enabled auto-merge November 2, 2026 22:11
@fm4v
fm4v added this pull request to the merge queue Nov 2, 2026
Merged via the queue into master with commit 3cb7638 Nov 3, 2026
186 checks passed
@fm4v
fm4v deleted the perf-iceberg-config branch November 3, 2026 01:17
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 3, 2026
PedroTadim pushed a commit to groeneai/ClickHouse that referenced this pull request Nov 4, 2026
The result digest added in ClickHouse#128261 runs every `FORMAT Null` query once more per server, which added about 43 min per architecture to each master commit and made the `master_head` shards time out. `perf.py --result-digest` now enables it, and `ci/jobs/performance_tests.py` passes it only in nightly runs.

Related: ClickHouse#129258
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Nov 6, 2026
…the performance tests

The setup of the test asserts two active parts with
`throwIf(count() != 2) FROM system.parts`. The Iceberg configuration
rewrites its ReplacingMergeTree table to IcebergLocal/IcebergS3, which
has no rows in `system.parts`, so the setup fails with Code 395
("expected 2 active parts") and so does the whole Iceberg perf shard.

The test came with ClickHouse#123326, whose last CI run (2026-10-26) predates
ClickHouse#128261, which started running the Iceberg jobs on the tests a PR adds,
so it never ran in this configuration before it reached master.

The reason is the one of lazy_final_early_exit_limit.xml,
lazy_materialization_final_limit.xml and read_in_reverse_order_final.xml,
which have the same check over `system.parts` plus FINAL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cursor Bot pushed a commit to ylw510/ClickHouse that referenced this pull request Nov 6, 2026
…e performance tests

The test has a `JSON(max_dynamic_paths = 0)` column, which the Iceberg
rewrite of the perf runner cannot map, so every Iceberg perf job that
selects it fails with `IcebergRewriteError: Column j of type JSON(...)
has no Iceberg equivalent` (6 PRs on 2026-11-05). It came from ClickHouse#124553,
whose last CI run predates the Iceberg jobs running on the tests a PR
adds (ClickHouse#128261), so it was never run in this configuration.

Add it to the skip list with the reason `JSON column`, like
prewhere_subcolumns.xml. Its other table (bucketed Map) measures a
MergeTree-only PREWHERE read-step behaviour, so there is nothing to
measure on Iceberg.

Validated with test_discovery.test_runs_with_table_engine: 291 tests
selected before, 290 after (this one removed).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
eoger-ant pushed a commit to eoger-ant/ClickHouse that referenced this pull request Nov 16, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). 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.

2 participants