Skip to content

e2e_plan cannot plan MetricsQL: UserInput::validate rejects every FrontendInput::Metricsql #534

Description

@zzylol

Problem

UserInput::validate (crates/planner/src/lib.rs, ~L87-104) accepts only these language/frontend pairs:

  • QueryLanguage::SQL(_) or QueryLanguage::DataFusion with FrontendInput::Sql
  • QueryLanguage::PromQL with FrontendInput::Promql

QueryLanguage (crates/types/src/workload.rs, ~L42) has the variants PromQL, SQL(_), DataFusion and ElasticDSL. None of them is MetricsQL. So any UserInput with FrontendInput::Metricsql fails validation with UserInputError::FrontendMismatch, and the FrontendInput::Metricsql branch of e2e_plan (~L253, lower_metricsql) is unreachable.

Before

Planning a MetricsQL workload through e2e_plan always fails before lowering, with FrontendMismatch { language: "PromQL", frontend: "Metricsql" } (or with whatever language is set).

Expected

A workload whose language is MetricsQL is accepted with FrontendInput::Metricsql, then lowered and planned.

Options

  1. Add QueryLanguage::MetricsQL (serde "metricsql") and accept it with FrontendInput::Metricsql. Recommended: the workload then states its language explicitly. It is an additive workload-format change, so check whether any deployment matches on QueryLanguage exhaustively.
  2. Accept QueryLanguage::PromQL with FrontendInput::Metricsql. Smaller, but it records MetricsQL workloads as PromQL.

Test

An e2e_plan test that plans one MetricsQL query end to end. It fails on main with FrontendMismatch.

Found while documenting extension scenarios for #533.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions