Skip to content

Share one query language contract - #576

Merged
zzylol merged 1 commit into
mainfrom
refactor/unify-query-language
Sep 10, 2026
Merged

zzylol merged 1 commit into
mainfrom
refactor/unify-query-language

Conversation

@zzylol

@zzylol zzylol commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Why

The backend defined three query-language enums: one in shared configuration, one in control-plane request types, and one in QueryPlan. Their variant sets had already drifted, so adding MetricsQL or ClickHouse support required parallel edits and conversions.

Before this PR

Legacy configuration recognized only a lowercase Rust promql variant, control-plane request DTOs defined PromQL, and executable query plans separately defined PromQl, MetricsQl, and ClickHouseSql.

After this PR

asap_types::QueryLanguage is the single backend contract and is re-exported by request and query-plan modules. It covers PromQL, MetricsQL, and ClickHouse SQL with one stable snake-case serde representation. CLI aliases continue to accept PROMQL and promql. Legacy aggregation parsing now handles both time-series languages and derives explicit table/value-column inputs for ClickHouse SQL.

Example

A QueryPlanEntry, adapter configuration, and control-plane request now carry the same QueryLanguage::MetricsQl value instead of crossing DTO-specific enum boundaries.

Verification

  • cargo check --workspace --all-targets
  • cargo test -p control_plane --lib query_plan::tests (5 passed)
  • cargo test -p control_plane --lib types_v2::tests (6 passed)
  • cargo test -p asap_types aggregation_config::tests (5 passed)
  • git diff --check

Depends on #575.

ClickHouse migration surface: use asap_types::QueryLanguage::ClickHouseSql through the existing control_plane::query_plan re-export; do not add a language-specific enum or catalog.

@zzylol
zzylol force-pushed the refactor/unify-sds-catalog-contract branch from a2ba424 to 445b60b Compare September 10, 2026 16:00
@zzylol
zzylol force-pushed the refactor/unify-query-language branch from 6259d62 to 482321b Compare September 10, 2026 16:00
@zzylol
zzylol force-pushed the refactor/unify-sds-catalog-contract branch from 445b60b to 0163b27 Compare September 10, 2026 16:08
@zzylol
zzylol force-pushed the refactor/unify-query-language branch from 482321b to 36e69c1 Compare September 10, 2026 16:09
@zzylol
zzylol force-pushed the refactor/unify-query-language branch from 36e69c1 to ae61b84 Compare September 10, 2026 16:31
@zzylol
zzylol changed the base branch from refactor/unify-sds-catalog-contract to main September 10, 2026 16:37
@zzylol
zzylol merged commit d08a2bb into main Sep 10, 2026
1 check passed
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.

1 participant