Skip to content

eval: RQE expression trees in e2e tables - #225

Merged
milindsrivastava1997 merged 2 commits into
mainfrom
222-eval-rqe-expression-trees-in-e2e-tables
Oct 15, 2026
Merged

milindsrivastava1997 merged 2 commits into
mainfrom
222-eval-rqe-expression-trees-in-e2e-tables

Conversation

@milindsrivastava1997

Copy link
Copy Markdown
Contributor

Closes #222. Part of #224 / ProjectASAP/ASAPQuery#886.

Every e2e query gets an expr field: its RQE expression tree (format in ProjectASAP/ASAPQuery#880). Leaves are self-contained (id, metric, capability, lookback_ms, grouping, phi/k, value).

  • template 10 becomes a / node over its two quantile leaves
  • rate queries get no expr (not a leaf capability)
  • a schema query merged across several RQEs (only with --keep-duplicate-queries) gets no expr
  • grouping is the query's output labels (for top-k: the per-series labels it returns, as ASAPQuery's QueryRequirements.grouping_labels)

Regenerated rqe-optimizer/results/e2e-rate10/inputs/tables/* with the same command as #217 (no re-solve); each equals the committed table once expr is removed, so plan files and RQE ids are unchanged. classic 42/46, all 92/96, multigroup 50/50 queries have expr (the rest are rate).

The §6.3 hydra tables (autosketch-vs-asap-hydra/inputs/tables) are not regenerated: they come from older exporter code, so re-running changes their RQEs.

Tests: python3 scripts/test_export_autosketch_eval_table.py (34 pass).

🤖 Generated with Claude Code

Every e2e query gets `expr`, its RQE expression tree: a leaf per RQE it
reads (id, metric or table, capability, lookback_ms, grouping, phi/k/value),
and a `/` node for template 10. Rate queries, and schema queries merged
across several RQEs (--keep-duplicate-queries), get none.

Regenerate the e2e-rate10 tables: only `expr` is added, so the RQE ids and
plans are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gKTCAEz3sJ1Hzde16xxU1

@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 (via Claude Code).

sort_keys=True)
if key in unique:
unique[key] = {**unique[key], "rqes": sorted(unique[key]["rqes"] + q["rqes"])}
merged = {k: v for k, v in unique[key].items() if k != "expr"}

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.

When schema queries that differ only in their RQEs are merged (templates 14, 15 and 17 under --keep-duplicate-queries), expr is dropped. The merged query then has no tree, though any one of its identical RQEs could answer it. That also makes the README line "Each query but rate carries expr" wrong for the §6.3 tables. Keeping the first query's expr would fix it.

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.

Declining. A merged query lists several RQEs in rqes, and ASAPQuery's --planner saved (ProjectASAP/ASAPQuery#888) refuses any query whose rqes differ from its expr leaves. So keeping the first tree would make these queries fail to convert instead of just lacking a tree. The README line is in e2e-rate10/README.md, whose tables never merge queries, so it holds there. The §6.3 tables don't run against ASAPQuery's data plane, so they need no trees.

Comment thread scripts/export_autosketch_eval_table.py Outdated
"24h": 86400}
SERIES_LABELS = ["job", "label_0"] # a classic metric's labels
# Capabilities an expression-tree leaf can read (no rate).
EXPR_CAPABILITY = {"sum": "sum", "quantile": "quantile", "cardinality": "cardinality",

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.

Nit: EXPR_CAPABILITY is mostly identity mappings. Its only real job is renaming topk to topk_by_value, so a set of leaf capabilities plus that one rename would say so directly.

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 2ba089e: LEAF_CAPABILITIES set, and rqe_leaf() renames only topk → topk_by_value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gKTCAEz3sJ1Hzde16xxU1
@milindsrivastava1997
milindsrivastava1997 merged commit 8bfa20e into main Oct 15, 2026
2 checks passed
milindsrivastava1997 added a commit that referenced this pull request Oct 15, 2026
#225's rqe_leaf() conflicts with #228's, which adds topk_by; kept #228's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

eval: RQE expression trees in e2e tables

1 participant