Skip to content

Commit 1c260e1

Browse files
More tests
1 parent c73246d commit 1c260e1

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7453,4 +7453,47 @@ public void testEvalLookupMultipleSorts() {
74537453
as(eval.child(), EsRelation.class);
74547454

74557455
}
7456+
7457+
public void testUnboundedSortSimple() {
7458+
var query = """
7459+
ROW x = [1,2,3], y = 1
7460+
| SORT y
7461+
| MV_EXPAND x
7462+
| WHERE x > 2
7463+
""";
7464+
7465+
VerificationException e = expectThrows(VerificationException.class, () -> plan(query));
7466+
assertThat(e.getMessage(), containsString("line 2:5: Unbounded sort not supported yet, please add a limit"));
7467+
}
7468+
7469+
public void testUnboundedSortWithMvExpandAndFilter() {
7470+
var query = """
7471+
FROM test
7472+
| EVAL language_code = 1
7473+
| LOOKUP JOIN languages_lookup ON language_code
7474+
| SORT language_name
7475+
| EVAL foo = concat(language_name, "foo")
7476+
| MV_EXPAND foo
7477+
| WHERE foo == "foo"
7478+
""";
7479+
7480+
VerificationException e = expectThrows(VerificationException.class, () -> plan(query));
7481+
assertThat(e.getMessage(), containsString("line 4:3: Unbounded sort not supported yet, please add a limit"));
7482+
}
7483+
7484+
public void testUnboundedSortWithLookupJoinAndFilter() {
7485+
var query = """
7486+
FROM test
7487+
| EVAL language_code = 1
7488+
| EVAL foo = concat(language_code::string, "foo")
7489+
| MV_EXPAND foo
7490+
| SORT foo
7491+
| LOOKUP JOIN languages_lookup ON language_code
7492+
| WHERE language_name == "foo"
7493+
""";
7494+
7495+
VerificationException e = expectThrows(VerificationException.class, () -> plan(query));
7496+
assertThat(e.getMessage(), containsString("line 5:3: Unbounded sort not supported yet, please add a limit"));
7497+
}
7498+
74567499
}

0 commit comments

Comments
 (0)