Skip to content

Commit 1f5dd50

Browse files
committed
Fail verification for subqueries
1 parent ba78f85 commit 1f5dd50

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/promql/PromqlCommand.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ public void postAnalysisVerification(Failures failures) {
151151
failures.add(fail(s, "offset modifiers are not supported at this time [{}]", s.sourceText()));
152152
}
153153
}
154+
if (lp instanceof Subquery) {
155+
failures.add(fail(lp, "subqueries are not supported at this time [{}]", lp.sourceText()));
156+
}
154157
if (step() != null && lp instanceof RangeSelector rs) {
155158
Duration rangeDuration = (Duration) rs.range().fold(null);
156159
if (rangeDuration.equals(step()) == false) {

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/promql/PromqlVerifierTests.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ public void testPromqlIllegalNameLabelMatcher() {
4949
);
5050
}
5151

52-
@Ignore
5352
public void testPromqlSubquery() {
54-
// TODO doesn't parse
55-
// line 1:36: Invalid query 'network.bytes_in'[ValueExpressionContext] given; expected Expression but found
56-
// InstantSelector
57-
assertThat(error("TS test | PROMQL step 5m (avg(rate(network.bytes_in[5m:])))", tsdb), equalTo(""));
58-
assertThat(error("TS test | PROMQL step 5m (avg(rate(network.bytes_in[5m:1m])))", tsdb), equalTo(""));
53+
assertThat(
54+
error("TS test | PROMQL step 5m (avg(rate(network.bytes_in[5m:])))", tsdb),
55+
equalTo("1:36: subqueries are not supported at this time [network.bytes_in[5m:]]")
56+
);
57+
assertThat(
58+
error("TS test | PROMQL step 5m (avg(rate(network.bytes_in[5m:1m])))", tsdb),
59+
equalTo("1:36: subqueries are not supported at this time [network.bytes_in[5m:1m]]")
60+
);
5961
}
6062

6163
@Ignore

0 commit comments

Comments
 (0)