Skip to content

Commit 96d00c2

Browse files
committed
more tests and restrict NESTED_XX to snapshot
1 parent 80ce2e7 commit 96d00c2

File tree

6 files changed

+539
-477
lines changed

6 files changed

+539
-477
lines changed

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/ForkIT.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,32 @@ public void testSortAndLimitOnlyInSecondSubQuery() {
262262
}
263263
}
264264

265+
public void testLimitOnlyInFirstSubQuery() {
266+
var query = """
267+
FROM test
268+
| FORK
269+
( LIMIT 100 )
270+
( WHERE content:"fox" )
271+
| SORT _fork, id
272+
| KEEP _fork, id, content
273+
""";
274+
try (var resp = run(query)) {
275+
assertColumnNames(resp.columns(), List.of("_fork", "id", "content"));
276+
assertColumnTypes(resp.columns(), List.of("keyword", "integer", "text"));
277+
Iterable<Iterable<Object>> expectedValues = List.of(
278+
List.of("fork1", 1, "This is a brown fox"),
279+
List.of("fork1", 2, "This is a brown dog"),
280+
List.of("fork1", 3, "This dog is really brown"),
281+
List.of("fork1", 4, "The dog is brown but this document is very very long"),
282+
List.of("fork1", 5, "There is also a white cat"),
283+
List.of("fork1", 6, "The quick brown fox jumps over the lazy dog"),
284+
List.of("fork2", 1, "This is a brown fox"),
285+
List.of("fork2", 6, "The quick brown fox jumps over the lazy dog")
286+
);
287+
assertValues(resp.values(), expectedValues);
288+
}
289+
}
290+
265291
public void testLimitOnlyInSecondSubQuery() {
266292
var query = """
267293
FROM test

x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ LEFT_BRACES : '{';
223223
RIGHT_BRACES : '}';
224224

225225
NESTED_WHERE : WHERE -> type(WHERE);
226-
NESTED_SORT : SORT -> type(SORT);
227-
NESTED_LIMIT : LIMIT -> type(LIMIT);
226+
NESTED_SORT : {this.isDevVersion()}? SORT -> type(SORT);
227+
NESTED_LIMIT : {this.isDevVersion()}? LIMIT -> type(LIMIT);
228228

229229
NAMED_OR_POSITIONAL_PARAM
230230
: PARAM (LETTER | UNDERSCORE) UNQUOTED_ID_BODY*

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseLexer.interp

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)