Skip to content

Add TPC-DS correctness tests - #99204

Merged
rienath merged 9 commits into
masterfrom
ci-tpc-ds
Mar 16, 2026
Merged

rienath merged 9 commits into
masterfrom
ci-tpc-ds

Conversation

@rienath

@rienath rienath commented Mar 10, 2026 •

Copy link
Copy Markdown
Member

Add TPC-DS correctness tests to CI. All 99 queries run against the standard SF1 dataset via web disk and are checked against reference output. The TPC-DS SF1 dataset is now lazily loaded into the datasets database, making it available for use in other tests too. Known ClickHouse issues are documented in the affected test files (#94683, #94858, #94976, #94671, #95168).

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

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

Add correctness tests for all 99 TPC-DS queries.


Note

Medium Risk
Primarily adds heavy CI coverage (TPC-DS dataset loading + many new query tests) which may increase CI runtime/flakiness and depends on external S3/web-disk availability, but does not change production query engine logic.

Overview
Adds a new CI step to provision the TPC-DS SF1 dataset into the datasets database by running tests/docker_scripts/create_tpcds.sh, which rewrites the benchmark init.sql to create MergeTree tables that read data from an S3-backed web disk.

Introduces a new stateless correctness test suite (04033_tpc_ds_*) that runs TPC-DS queries with shared settings from tests/benchmarks/tpc-ds/settings.json (including a higher --max_rows_to_read) and validates results against new .reference outputs; some queries are tagged long/skipped and document known issues.

Wires dataset creation into existing CI/stress setup paths (clickhouse_proc.py and stress_runner.sh) so the datasets schema is available for these tests (and others) during runs.

Written by Cursor Bugbot for commit f26f160. This will update automatically on new commits. Configure here.

Version info

  • Merged into: 26.3.1.695

@clickhouse-gh

clickhouse-gh Bot commented Mar 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f26f160]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_binary, flaky check) failure
Received signal 6 (signal sent by pid 167458 from user 0) (STID: 1615-1ce3) FAIL cidb IGNORED
Scraping system tables FAIL cidb IGNORED

See #99204 (comment) to understand why test failure is expected


AI Review

1) Summary

This PR adds full TPC-DS correctness coverage (99 stateless shell tests with references), a shared settings library, and hooks to pre-create TPC-DS SF1 tables via web disk in CI setup paths. The test coverage scope is strong, but the new setup calls introduce an unconditional external dependency that can make unrelated CI jobs fail during environment preparation. High-level verdict: request changes for CI reliability isolation.

2) Missing context (if any)

  • No full Praktika artifact/log analysis was provided for this review pass (only high-level check status, with several checks still pending).
  • No benchmark or flakiness data was provided to justify unconditional dataset bootstrap in all relevant setup paths.

3) Findings (by severity)

Blockers

  • None.

Majors

  • [ci/jobs/scripts/clickhouse_proc.py:698] prepare_stateful_data now always runs create_tpcds.sh, which depends on external https://tpc-ds-sf1.s3.amazonaws.com. A transient endpoint/network issue will fail setup for unrelated stateful jobs before tests start.
    • Suggested fix: gate TPC-DS bootstrap behind a dedicated CI flag/test selector (enabled only for jobs that need it), or add bounded retries plus an explicit opt-out path.
  • [tests/docker_scripts/stress_runner.sh:63] stress setup also unconditionally pulls in the same external TPC-DS dependency, widening blast radius for transient remote failures and introducing avoidable instability in stress runs not targeting TPC-DS coverage.
    • Suggested fix: reuse the same gating/feature-flag mechanism and only enable this step when TPC-DS coverage is part of the run contract.

4) Tests & Evidence

  • Coverage assessment: positive coverage is broad (99 query scripts + reference outputs), including documented known-problem skips.
  • Negative/error-handling tests: no explicit failure-path tests are added for dataset bootstrap unavailability (S3 endpoint failure, timeout, throttling).
  • Additional tests to add:
    • A CI-path test (or script-level check) proving non-TPC-DS jobs skip create_tpcds.sh when the feature flag is disabled.
    • A failure-path test for bootstrap exceptions (endpoint unavailable) that validates clear exception messaging and retry/skip behavior.

5) ClickHouse Compliance Checklist (Yes/No + short note)

  • Data deletions logged? Yes — no new deletion logic introduced.
  • Serialization formats versioned? N/A — no serialization/protocol changes.
  • Experimental setting gate present? No — behavior rollout in CI setup is unconditional today.
  • Settings exposed for constants/thresholds? Partial — query settings are centralized in 04033_tpc_ds.lib; rollout gating is still missing.
  • Backward compatibility preserved? Yes — no server/runtime compatibility surface changed.
  • SettingsHistory.cpp updated for new/changed settings? N/A — no server settings added.
  • Existing tests untouched (only additions)? Yes — this PR adds new test files.
  • Docs/user-facing notes updated? Partial — inline comments/tags describe known issues, but CI rollout behavior/risk is not documented.
  • Core-area change got extra scrutiny? Yes — review focused on CI reliability and setup-path behavior.

6) Performance & Safety Notes

  • Runtime/infra impact: setup now performs additional remote table bootstrap, increasing startup latency and external dependency sensitivity.
  • Safety/failure modes: primary risk is setup exception propagation from transient S3/network failures, causing non-target jobs to fail early.
  • Benchmarks: none provided; minimal reproducible measurement should compare setup duration/failure rate with and without TPC-DS bootstrap under controlled network impairment.

7) User-Lens Review

  • The new coverage is useful and conceptually straightforward for maintainers, but rollout is currently too broad for users/operators of CI jobs not targeting TPC-DS.
  • Error messages are generally actionable; however, isolation controls are needed so failures in external dataset bootstrap do not surprise unrelated pipelines.

8) Final Verdict

  • Status: Request changes
  • Minimum required actions:
    1. Add a dedicated gate/selector so create_tpcds.sh runs only in jobs that require TPC-DS datasets.
    2. Apply the same gating consistently in both clickhouse_proc.py and stress_runner.sh.

@clickhouse-gh clickhouse-gh Bot added the pr-build Pull request with build/testing/packaging improvement label Mar 10, 2026
rienath added 5 commits March 10, 2026 15:46
By accumulating settings from test/benchmarks/settings.json using .lib file, and then referring to it in the tests
If some queries return unexpected result (which is now expected by .reference file) or have alternative formulation, the comments now clarify that and link the issue
rienath added 3 commits March 10, 2026 16:52
TPC-DS queries scan large tables, exceeding the default row limit in CI
no-replicated-database: the "datasets" database is not created with "DatabaseReplicated", because "prepare_stateful_data" is skipped entirely for replicated setups ("ci/jobs/scripts/clickhouse_proc.py:686").

long: using it in 6 slow queries (q04, q09, q14, q23, q50, q69) rather than "no-flaky-check" so the tests still run in flaky validation.
@rienath

rienath commented Mar 12, 2026

Copy link
Copy Markdown
Member Author

The Stateless tests (amd_binary, flaky check) failure is likely due to us running 99 times × 50 runs each in the flaky check. This generates millions of trace_log entries whose flush doesn't complete during shutdown (see errors before the server is killed)

It's unlikely we will ever run all 99 queries together in a flaky check again, so the error can be ignored. I can enable no-flaky-check if needed, but it'd be cool to keep TPC-DS in our flaky check arsenal.

@rienath
rienath marked this pull request as ready for review March 12, 2026 15:33

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread tests/docker_scripts/create_tpcds.sh Resolved
Comment thread tests/docker_scripts/stress_runner.sh Resolved
Comment thread ci/jobs/scripts/clickhouse_proc.py Resolved
@rschu1ze rschu1ze self-assigned this Mar 13, 2026

@rschu1ze rschu1ze left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, thanks.

As a follow-up question, would it be possible to introduce a similar correctness test for TPC-H as well?

@rienath

rienath commented Mar 16, 2026 •

Copy link
Copy Markdown
Member Author

@rschu1ze yes, will do!

UPD: in a separate PR :)

@rienath
rienath added this pull request to the merge queue Mar 16, 2026
Merged via the queue into master with commit be1ddc8 Mar 16, 2026
159 of 160 checks passed
@rienath
rienath deleted the ci-tpc-ds branch March 16, 2026 11:18
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-build Pull request with build/testing/packaging improvement 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