Skip to content

feat(asap-tools): sketchdb arm for sketch-bench ClickHouse workloads - #901

Merged
milindsrivastava1997 merged 3 commits into
mainfrom
874-pr3-sketchdb-arm-generator
Oct 15, 2026
Merged

milindsrivastava1997 merged 3 commits into
mainfrom
874-pr3-sketchdb-arm-generator

Conversation

@milindsrivastava1997

@milindsrivastava1997 milindsrivastava1997 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Closes #874 (3 of 3). Stacked on #900; review only its commits.

Problem: sketch_bench_workloads.py wrote asapquery.sql for an ASAPQuery arm, but no config read it.

Fix:

  • Structured entries get their own query groups (interval_<T>s_structured), ordered before the PromQL groups (interval_<T>s). With --prebuilt-output-dir, each gets a sketchdb SQL file (the entry's sql with NOW() replaced by the floored eval time), in place of asapquery.sql; without it no sketchdb SQL is written.
  • --prebuilt-output-dir (e.g. from asap-planner --planner saved) writes <stem>_clickhouse_sketchdb.yaml: baseline and sketchdb in one experiment, so calculate_fidelity can score sketchdb against baseline, with controller.prebuilt_output_dir set (hence @package _global_).
  • sketchdb runs only the structured groups. They come first, so its query indices are baseline's (this answers the issue's open question without rendering PromQL entries as ASAPQuery SQL).
  • The flag raises if no entry is structured. A re-run without it removes a stale sketchdb config.

The group split renames files and reorders groups in every arm's config.

Tests: tests/test_sketch_bench_workloads.py, including an end-to-end check: the generated sketchdb client config gets only the structured group and passes the runner's prebuilt-plan check against a saved plan on NOW().

🤖 Generated with Claude Code

@milindsrivastava1997 milindsrivastava1997 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Code review findings (Claude Code).

outputs[os.path.join(sql_dir, "asapquery.sql")] = statements_text(asapquery)
files[BASELINE_MV].append(comment + mv_sql(q, views, labels))
if structured:
files[SKETCHDB].append(comment + asapquery_sql(entry))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Without --prebuilt-output-dir, structured groups still get a sketchdb SQL file and a sketchdb key in the sql_file of the baseline and baseline_mv configs, even though no config runs sketchdb. Every run writes unused interval_<T>s_structured_sketchdb.sql files, and the configs suggest a sketchdb arm that doesn't exist. Suggest adding SKETCHDB to the group's modes only when prebuilt_output_dir is set.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 828d6aa: sketchdb SQL files and sql_file entries are written only with --prebuilt-output-dir. The ASAPQuery SQL is still rendered, so a bad table entry fails either way.

milindsrivastava1997 and others added 3 commits October 15, 2026 12:32
Structured entries get their own query groups, ordered before the
PromQL ones, each with a sketchdb SQL file (the entry's ASAPQuery SQL)
in place of asapquery.sql. With --prebuilt-output-dir the generator
writes <stem>_clickhouse_sketchdb.yaml: baseline and sketchdb in one
experiment on those planner configs, so sketchdb's query indices are
baseline's first and its results can be scored against baseline's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without --prebuilt-output-dir no config runs sketchdb, yet structured
groups got sketchdb SQL files and sql_file entries. They are now
written only with the flag; the ASAPQuery SQL is still rendered, so a
bad entry fails either way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The engine's ClickHouse adapter serves SQL at /clickhouse/query; the
query client posted to the server URL's root, so every sketchdb query
got a 404.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milindsrivastava1997
milindsrivastava1997 force-pushed the 874-pr3-sketchdb-arm-generator branch from f9f9846 to a098c70 Compare October 15, 2026 16:32
@milindsrivastava1997
milindsrivastava1997 changed the base branch from 874-pr2-feed-sketchdb-arm to main October 15, 2026 16:32
@milindsrivastava1997
milindsrivastava1997 merged commit ba34623 into main Oct 15, 2026
11 of 12 checks passed
@milindsrivastava1997
milindsrivastava1997 deleted the 874-pr3-sketchdb-arm-generator branch October 15, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

asap-tools: feed the sketchdb arm in the ClickHouse runner

1 participant