Skip to content

Commit 4761c3e

Browse files
zzylolclaude
andcommitted
chore(devtools): delete show_post_asap_ir, rename show_pre_asap_ir
show_post_asap_ir ranked candidates with the legacy cost model; stage_pipeline shows how the planner plans a query. show_pre_asap_ir becomes show_logical_dag, the name of what it prints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 281858b commit 4761c3e

5 files changed

Lines changed: 17 additions & 262 deletions

File tree

‎crates/devtools/Cargo.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ asap-logical-optimizer = { path = "../logical-optimizer" }
1616
# plans with. A devtool, not a stage crate, so the #572 guards allow it.
1717
asap-executor = { path = "../executor" }
1818

19-
# Used by the show_*_ir / stage_pipeline / variant_coverage bins (catalog schemas,
20-
# async SQL path, JSON output) and by the topk_ir / canonical_examples
21-
# examples. Regular deps, not dev-deps: `[[bin]]` targets can't see dev-deps.
19+
# Used by the show_logical_dag / stage_pipeline / variant_coverage bins
20+
# (catalog schemas, async SQL path, JSON output) and by the topk_ir /
21+
# canonical_examples examples. Regular deps, not dev-deps: `[[bin]]` targets can't see dev-deps.
2222
asap-types = { path = "../types" }
2323
serde = { version = "1", features = ["derive"] }
2424
serde_json = "1"

crates/devtools/src/bin/show_pre_asap_ir.rs renamed to crates/devtools/src/bin/show_logical_dag.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
// cargo run -p asap-devtools --bin show_pre_asap_ir -- queries.txt
2-
// (or pipe via stdin: cargo run -p asap-devtools --bin show_pre_asap_ir < queries.txt)
1+
// cargo run -p asap-devtools --bin show_logical_dag -- queries.txt
2+
// (or pipe via stdin: cargo run -p asap-devtools --bin show_logical_dag < queries.txt)
33
//
44
// Lowers a batch of ad-hoc SQL/PromQL queries to **pre-ASAP IR** (the
55
// sketch-agnostic intent algebra: an `OperatorNode` DAG of `NonASAPOp`
6-
// operators with `AggIntent` measures) and prints them.
7-
// See `show_post_asap_ir` for the post-ASAP sketch-bound IR one layer
8-
// downstream — this tool never picks a sketch, it only shows what a query
9-
// means.
6+
// operators with `AggIntent` measures) and prints them. This tool never
7+
// picks a sketch, it only shows what a query means; `stage_pipeline` shows
8+
// how the planner plans it.
109
//
1110
// File format: one query per line, prefixed with "sql>" or "promql>".
1211
// Blank lines and lines starting with '#' are ignored.
@@ -49,7 +48,7 @@ async fn main() {
4948
assert_eq!(
5049
args.next().as_deref(),
5150
Some("--data-ingestion-interval-ms"),
52-
"usage: show_pre_asap_ir --data-ingestion-interval-ms <ms> [queries.txt]"
51+
"usage: show_logical_dag --data-ingestion-interval-ms <ms> [queries.txt]"
5352
);
5453
let interval_ms = args
5554
.next()

‎crates/devtools/src/bin/show_post_asap_ir.rs‎

Lines changed: 0 additions & 205 deletions
This file was deleted.

‎docs/develop_docs/library-api.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ async lower_sql_dialect(query: &str, catalog: &SqlCatalog,
141141
| `ElasticSQL` | Returns `UnsupportedDialect` |
142142

143143
The catalog is required and describes your tables. For a complete schema-building
144-
example, see [the CLI frontend example](../../crates/devtools/src/bin/show_pre_asap_ir.rs).
144+
example, see [the CLI frontend example](../../crates/devtools/src/bin/show_logical_dag.rs).
145145

146146
## Generate and rank candidates
147147

‎docs/user_guide_docs/run-a-query.md‎

Lines changed: 7 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ tool on first use.
1515

1616
| Command (`cargo run -p asap-devtools --bin … -- …`) | Input / options | Result |
1717
| --- | --- | --- |
18-
| `show_pre_asap_ir --data-ingestion-interval-ms 1000 queries.txt` | File path, or stdin when omitted | Prints canonical Pre-ASAP IR |
19-
| `show_post_asap_ir --data-ingestion-interval-ms 1000 queries.txt` | Same query file format | Prints all sketch-strategy Post-ASAP candidates using a fixed approximate target, in cost-model order |
18+
| `show_logical_dag --data-ingestion-interval-ms 1000 queries.txt` | File path, or stdin when omitted | Prints canonical Pre-ASAP IR |
2019
| `analyze_corpora --corpora --data-ingestion-interval-ms 1000 --out-dir <dir>` | Repository PromQL corpora, output directory | Writes successful/error IR dumps and summary reports |
2120
| `analyze_corpora --sql-corpora --out-dir <dir>` | Repository SQL corpora, output directory | Writes SQL corpus reports |
2221
| `variant_coverage --data-ingestion-interval-ms 1000` | Repository corpora | Reports Pre-ASAP IR variant coverage |
@@ -38,8 +37,8 @@ promql> quantile(0.99, rate(http_requests_total[5m]))
3837
sql> SELECT service, COUNT(*) FROM metrics GROUP BY service
3938
```
4039

41-
Blank lines and lines beginning with `#` are ignored. The two file/stdin tools
42-
accept `sql>` and `promql>`; MetricsQL is available through the library frontend.
40+
Blank lines and lines beginning with `#` are ignored. The file/stdin tool
41+
accepts `sql>` and `promql>`; MetricsQL is available through the library frontend.
4342
SQL examples use the fixed catalog
4443
`metrics(ts: Timestamp, service: Utf8, region: Utf8, latency: Float64, bytes: Int64)`.
4544
For your own schema, provide a `SqlCatalog` through the library API.
@@ -49,13 +48,13 @@ For your own schema, provide a `SqlCatalog` through the library API.
4948
Run:
5049

5150
```sh
52-
cargo run -p asap-devtools --bin show_pre_asap_ir -- --data-ingestion-interval-ms 1000 queries.txt
51+
cargo run -p asap-devtools --bin show_logical_dag -- --data-ingestion-interval-ms 1000 queries.txt
5352
```
5453

5554
You can also provide the queries through stdin:
5655

5756
```sh
58-
cargo run -p asap-devtools --bin show_pre_asap_ir -- --data-ingestion-interval-ms 1000 < queries.txt
57+
cargo run -p asap-devtools --bin show_logical_dag -- --data-ingestion-interval-ms 1000 < queries.txt
5958
```
6059

6160
To dump and compare every PromQL corpus, run:
@@ -76,44 +75,6 @@ The corresponding SQL corpus analysis is:
7675
cargo run -p asap-devtools --bin analyze_corpora -- --sql-corpora --out-dir artifacts/sql_pre_asap
7776
```
7877

79-
### Inspect Post-ASAP IR candidates
80-
81-
Run:
82-
83-
```sh
84-
cargo run -p asap-devtools --bin show_post_asap_ir -- --data-ingestion-interval-ms 1000 queries.txt
85-
```
86-
87-
Or through stdin:
88-
89-
```sh
90-
cargo run -p asap-devtools --bin show_post_asap_ir -- --data-ingestion-interval-ms 1000 < queries.txt
91-
```
92-
93-
`show_post_asap_ir` uses an approximation target of ε = 0.01 and prints every
94-
available binding from the sketch strategy for each query, numbered in cost-model
95-
order. If no candidate is available, it prints the pre-ASAP fallback as candidate
96-
1. It does not show the complete ranked workload candidate set or choose a
97-
deployment. Its SQL examples use a fixed demonstration catalog, not
98-
your database schema. Use the
99-
[library workflow](../develop_docs/library-api.md) to retain workload alternatives
100-
and provide your own models.
101-
102-
The default strategy generates DDSketch quantile-ratio candidates even when no
103-
input-domain evidence is available. Such candidates have `guarantee: None`:
104-
they do not claim a certified end-to-end accuracy bound. They also remain
105-
visible in a target-aware `CandidateLogicalASAPDAGs` so the downstream backend can decide
106-
whether to select them using its own evidence. Planner's automatic
107-
`global_selection` skips them; their presence alone does not show that they
108-
meet the requested target.
109-
110-
Each input line is followed by its debug IR or an `ERR:` message. Pre-ASAP and
111-
Post-ASAP output use the same node format: Post-ASAP output adds summary nodes
112-
(state, readouts) and keeps the original exact operators wherever no summary
113-
replaces them. An
114-
approximate target permits approximation; it does not guarantee a legal or
115-
certified sketch. The tool prints plans, not query results.
116-
11778
## More inspection commands
11879

11980
### See how the planner plans a workload
@@ -166,5 +127,5 @@ cargo run -p asap-devtools --example canonical_examples
166127

167128
PromQL commands require `--data-ingestion-interval-ms` with the nonzero source
168129
sample cadence in milliseconds. The examples use a one-second cadence; supply
169-
the interval for your data. The mixed-input `show_pre_asap_ir` and
170-
`show_post_asap_ir` tools require this option even for SQL-only input files.
130+
the interval for your data. The mixed-input `show_logical_dag` tool requires
131+
this option even for SQL-only input files.

0 commit comments

Comments
 (0)