Skip to content

feat(asap-common): RQE expression tree type and validation #880

Closed

Description

@milindsrivastava1997

Part of the RQE frontend tracker (linked below once filed). Decisions live in the tracker.

What

A shared serde type for an RQE expression tree in asap-common/dependencies/rs/asap_types, used by the planner (--planner saved) and the query engine.

{"op": "/", "lhs": {"rqe": {...}}, "rhs": {"rqe": {...}}}

Node kinds (tagged enum):

  • rqe: a self-contained leaf: id, metric (a table name for SQL), capability, lookback_ms, grouping (labels), optional phi (quantile), optional k (top-k), optional value (SQL value column).
  • agg: {"agg": "avg|min|max|sum", "by": [labels], "of": <node>}
  • binary: {"op": "+|-|*|/", "lhs": <node>, "rhs": <node>}
  • scalar: {"scalar": <f64>}

Validation (one function, called at load)

  • leaf capability is one of sum, quantile, cardinality, topk_by_value (others rejected: rate, topk_by_count, …)
  • phi present iff quantile; k present iff top-k
  • agg.by is a subset of the child's output labels
  • binary: two non-scalar sides must have the same output label set; at least one side is non-scalar
  • a top-k leaf is only allowed at the root

Also: a helper returning the tree's leaves, and one returning a node's output labels.

Done when

  • type + validation + unit tests (each rule has a rejecting test; round-trip JSON tests for every node kind)

Activity

  1. milindsrivastava1997 commented on Oct 14, 2026

    @milindsrivastava1997
    ContributorAuthor

    Tracker: #886

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions