Skip to content

ci: key TPC dataset caches on pinned generators - #6112

Open
ErikBPF wants to merge 5 commits into
apache:mainfrom
ErikBPF:ci/tpc-cache-key
Open

ErikBPF wants to merge 5 commits into
apache:mainfrom
ErikBPF:ci/tpc-cache-key

Conversation

@ErikBPF

@ErikBPF ErikBPF commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Closes #6102.

The TPC-H and TPC-DS dataset caches were keyed on
hashFiles('.github/workflows/pr_build_linux.yml'), so any workflow edit
regenerated both datasets and left entries that a later run can never restore.
The generators were also unpinned: GenTPCHData cloned tpch-dbgen HEAD and
the tpcds-kit checkout had no ref:.

This pins both generators and keys the datasets on their inputs:

  • TPC-H key is the hash of GenTPCHData.scala; the generator checks out a fixed
    tpch-dbgen commit before applying the stdout patch.
  • TPC-DS key embeds the pinned tpcds-kit commit, which the checkout names
    explicitly.
  • Both caches are split into actions/cache/restore plus a save step guarded to
    main, matching the cache-write policy used for other large caches.

check_tpc_dataset_caches() in dev/ci/check-ci-config.py asserts the key
shape, the pinned ref:, and that the TPC caches are no longer bare
actions/cache@vN.

Testing: the new guard fails on the previous revision with five findings and
passes after the change (CI config checks passed); dev/ci/check-suites.py
also passes.

The TPC-H and TPC-DS dataset caches were keyed on the hash of
pr_build_linux.yml, so every workflow edit regenerated both datasets and
left useless entries that evict main's. The generators were also
unpinned: GenTPCHData cloned tpch-dbgen HEAD and the tpcds-kit checkout
had no ref, so a generator change could not rotate a dataset key.

Pin both generators and key the datasets on their inputs instead:

- TPC-H key is the hash of GenTPCHData.scala; the generator now checks
  out a fixed tpch-dbgen commit before applying the stdout patch.
- TPC-DS key embeds the pinned tpcds-kit commit, which the checkout
  now names explicitly.

Save both from main only, matching the cache-write policy for other
large caches. check_tpc_dataset_caches() in dev/ci/check-ci-config.py
asserts all of the above so the old shape cannot come back.
@github-actions github-actions Bot added build Build environment enhancement New feature or request labels Sep 22, 2026

@sunchao sunchao 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.

Summary

  • Prior state and problem: Workflow edits invalidated both TPC datasets, and generator revisions were not fully pinned.
  • Design approach: Pin both generators, key datasets on generator inputs, and save caches only from main.
  • Correctness / compatibility analysis: Both pins match current upstream heads. Checked Spark’s generator sources for supported versions 3.4.3, 3.5.9, 4.0.4, 4.1.3, and 4.2.0. No introduced P1/P2 issues found within this review.
  • Key design decisions: Explicit restore/save steps fit the existing cache policy. The change adds no query-runtime overhead or new abstraction layer.
  • Implementation sketch: Updates two workflow caches, pins GenTPCHData before applying its existing stdout patch, and adds configuration checks.
  • Behavioral changes worth calling out: Unrelated workflow edits retain cached data. PR and queue runs restore caches but regenerate on misses without saving.
  • Suggested improvements: None meeting the P1/P2 reporting threshold.

Reviewed the full three-file diff from 9a4d5f28368d4fbb54ac23c14c5d52d5637ce26d to fb6260914e170276ec0bd87d105bbafdbfcc572e. Confirmed non-draft status. Read the discussion snapshot and live reviews/comments/threads, all empty. Routed skill: review-comet-pr; no sibling skill applies.

Exact-head CI: label passed. Comet CI, CodeQL, and Check PR Title report action_required. Comet CI has no executed jobs, so there is no build/test verdict.

Local validation passed: CI configuration checks, suite registration, workflow actionlint, and the new guard’s five expected failures against base fixtures. Both pinned data generators compiled, and bounded SF=1 stdout tests produced expected row counts. Full Maven/native builds, Spark Parquet generation, benchmark query suites, and hosted cache restore/save behavior were not executed. The project working tree remains unchanged.

@andygrove

Copy link
Copy Markdown
Member

This is a light fully automated review since there are so many PRs open.

The restore/save split matches the existing Maven cache pattern well.

.github/workflows/README.md:396-399 still describes the setup this PR replaces. It says the TPC-H and TPC-DS dataset caches "keep the read-write form and are out of scope entirely" and that they are "keyed on this workflow file". After this change they use actions/cache/restore plus a main-only actions/cache/save, the same pattern the section documents for the Maven and cargo caches just above, and they are keyed on GenTPCHData.scala and the pinned tpcds-kit commit. Could this paragraph be updated to match what pr_build_linux.yml does now?

The new keys at pr_build_linux.yml:707 and :792 also no longer cover the generator arguments. --scaleFactor 1 --numPartitions 1 is passed at :716 and :816 and lives only in the workflow file, which the old key hashed. If a later change bumps --scaleFactor without touching GenTPCHData.scala or the tpcds-kit ref, the cache still hits, the generate step is skipped, and the queries run against the old dataset. Would it make sense to fold the scale factor and partition count into the keys?

The TPC-H and TPC-DS dataset caches were keyed on the hash of
pr_build_linux.yml, so every workflow edit regenerated both datasets and
left useless entries that evict main's. The generators were also
unpinned: GenTPCHData cloned tpch-dbgen HEAD and the tpcds-kit checkout
had no ref, so a generator change could not rotate a dataset key.

Pin both generators and key the datasets on their inputs instead:

- TPC-H key is the hash of GenTPCHData.scala; the generator now checks
  out a fixed tpch-dbgen commit before applying the stdout patch.
- TPC-DS key embeds the pinned tpcds-kit commit, which the checkout
  now names explicitly.

Save both from main only, matching the cache-write policy for other
large caches. check_tpc_dataset_caches() in dev/ci/check-ci-config.py
asserts all of the above so the old shape cannot come back.
Keep the verified refreshed tree while retaining the published head
as an ancestor, allowing a normal push without rewriting history.
@github-actions github-actions Bot added area:writer Native Parquet writer area:shuffle Shuffle (JVM and native) area:aggregation Hash aggregates, aggregate expressions area:scan Parquet scan / data reading area:expressions Expression evaluation area:ffi Arrow FFI / JNI boundary area:Iceberg area:udf area:memory Memory pools, reservations, OOM handling area:joins Join operators and dynamic filter pushdown labels Oct 2, 2026
@ErikBPF

ErikBPF commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated against pinned main 63fd1c9e and addressed the cache-input/documentation feedback. Published ancestry is retained with an identical-tree merge, without force-pushing.

Scale factor and partition count now come from the same job inputs used by actual generator arguments, restore/save cache keys, and dataset/query paths. Pinned generators, exact-match dataset restores, main-only saves and upstream Cargo policy are retained. The workflow README now describes this behavior accurately.

Verification on Apollo:

  • The extended guard failed on the rebased pre-fix workflow with ten expected coupling diagnostics, then passed after the fix.
  • 15 input/mutation checks passed, along with CI/suite guards, formatting and actionlint.
  • The Maven reactor and RAT checks passed; Maven tests were explicitly skipped.
  • Actual Maven/Spark TPC-H region generation produced one Parquet file containing five rows. Pinned native stdout checks produced five region and 25 nation rows.
  • Independent source review passed; the final patch exactly matches the reviewed snapshot.

Limitations: the local TPC-H build used gcc -std=gnu17, so this does not establish literal hosted compiler parity. TPC-DS native build remains blocked at print.c:235 by -Werror=format-security after three repairs; no hardening/assertions were weakened. Full datasets, query suites, TPC-DS Spark generation and hosted cache behavior were not verified.

Updated head: f087cf42c3367cec43ceb54b20643462a93c469a (tested tree unchanged from 7f68df22fe93635abce40c5ca66052c9879bcf23).

TPC-DS follow-up

TPC-DS follow-up: a sandbox-only fprintf → fputs fix retained compiler hardening. Native generation and Spark conversion passed: 35 rows, one Parquet file. Independent review passed.

PR source remains unchanged. Local generator patch and compiler compatibility flags were required; unmodified hosted-workflow compatibility and full TPC-DS/query suites remain unverified.

Current-main diff correction

Both intended commits were rebased onto ca1c143a. An ordinary merge of actual main preserved public ancestry without force-pushing and produced exactly the clean rebased tree. GitHub Files Changed is now verified at 4 files, +173/-22: workflow README, Linux workflow, CI guard and the existing GenTPCHData.scala change. No sandbox generator fix was added to the PR.

Current-base input/mutation checks (15), CI/suite guards, benchmark checker (55 suites), inventory/summary tests and workflow formatting checks passed. Previous TPC-H and patched-local TPC-DS runtime evidence remains tied to the earlier source/base and its recorded compatibility overrides, not a new-base runtime or hosted-cache claim.

Updated head: a21349caf3ce8570256a8e42d5f3b3fd57d6d032.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:aggregation Hash aggregates, aggregate expressions area:expressions Expression evaluation area:ffi Arrow FFI / JNI boundary area:Iceberg area:joins Join operators and dynamic filter pushdown area:memory Memory pools, reservations, OOM handling area:scan Parquet scan / data reading area:shuffle Shuffle (JVM and native) area:udf area:writer Native Parquet writer build Build environment enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: key the TPC dataset caches on pinned generators

3 participants