ES|QL: Add parameterized query support to PromQL parser#144293
Merged
felixbarny merged 5 commits intoelastic:mainfrom Mar 19, 2026
Merged
ES|QL: Add parameterized query support to PromQL parser#144293felixbarny merged 5 commits intoelastic:mainfrom
felixbarny merged 5 commits intoelastic:mainfrom
Conversation
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
… parens - Add PromqlParserTests covering the new (?param) / ?param syntax for the whole PromQL expression and the index=?param syntax - Fix NPE in LogicalPlanBuilder when an unknown param name is used as the PromQL expression (null-check result of paramByNameOrPosition) - Extend Promql.g4 with an unparenthesized alternative so ?query works in addition to (?query); regenerate EsqlBaseParser
- Allow `value=?query` (unparenthesized) in the PromQL grammar by adding `(valueName ASSIGN)?` to the unparenthesized param alternative; there's no ambiguity here unlike the inline query case - Validate blank string params with a clear ParsingException instead of passing an empty query to the inner PromQL parser - Add null check and type validation in parseIndexPattern so unknown or non-string index params produce a ParsingException instead of NPE / silent toString coercion - Add tests for all new error paths and for value=?query without parens
This was referenced Mar 16, 2026
kkrik-es
approved these changes
Mar 19, 2026
de1658c to
a9179a1
Compare
ncordon
pushed a commit
to ncordon/elasticsearch
that referenced
this pull request
Mar 20, 2026
Extends the `Promql.g4` grammar so PromQL queries can be provided as named query parameters instead of being inlined as string literals Examples: ``` PROMQL ... ?param PROMQL ... (?param) PROMQL ... value=?param PROMQL ... value=(?param) ```
michalborek
pushed a commit
to michalborek/elasticsearch
that referenced
this pull request
Mar 23, 2026
Extends the `Promql.g4` grammar so PromQL queries can be provided as named query parameters instead of being inlined as string literals Examples: ``` PROMQL ... ?param PROMQL ... (?param) PROMQL ... value=?param PROMQL ... value=(?param) ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends the
Promql.g4grammar so PromQL queries can be provided as named query parameters instead of being inlined as string literalsExamples:
This is a standalone change — it adds value for any caller of the
PROMQLES|QL command and has no dependency on the Prometheus plugin.Stacking order
/api/v1/query_range) endpoint #144303Overview: #144294