Skip to content

Commit

Permalink
feat: allow cross-schema query in promql (#3545)
Browse files Browse the repository at this point in the history
* feat: add __schema__ tag for promql parser

* feat: disable matcher op other than equals

* test: add more test to ensure context getting reset

* test: add integration test

* test: refactor tests

* refactor: remove duplicated test code

* refactor: update according to review comments

* test: add sqlness test for cross schema scenario

---------

Co-authored-by: Ruihang Xia <[email protected]>
  • Loading branch information
sunng87 and waynexia authored Mar 29, 2024
1 parent f49cd0c commit 500f9f1
Show file tree
Hide file tree
Showing 6 changed files with 368 additions and 101 deletions.
8 changes: 8 additions & 0 deletions src/promql/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ pub enum Error {
operator: String,
location: Location,
},

#[snafu(display("Matcher operator {matcher_op} is not supported for {matcher}"))]
UnsupportedMatcherOp {
matcher_op: String,
matcher: String,
location: Location,
},
}

impl ErrorExt for Error {
Expand All @@ -157,6 +164,7 @@ impl ErrorExt for Error {
| DataFusionPlanning { .. }
| MultiFieldsNotSupported { .. }
| UnexpectedPlanExpr { .. }
| UnsupportedMatcherOp { .. }
| IllegalRange { .. } => StatusCode::InvalidArguments,

UnknownTable { .. } | EmptyRange { .. } => StatusCode::Internal,
Expand Down
Loading

0 comments on commit 500f9f1

Please sign in to comment.