Skip to content

Commit a5d30ef

Browse files
Better error message
1 parent 1c260e1 commit a5d30ef

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,6 @@ public void postAnalysisVerification(Failures failures) {
113113

114114
@Override
115115
public void postOptimizationVerification(Failures failures) {
116-
failures.add(fail(this, "Unbounded sort not supported yet, please add a limit"));
116+
failures.add(fail(this, "Unbounded sort not supported yet [{}] please add a limit", this.sourceText()));
117117
}
118118
}

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7463,7 +7463,7 @@ public void testUnboundedSortSimple() {
74637463
""";
74647464

74657465
VerificationException e = expectThrows(VerificationException.class, () -> plan(query));
7466-
assertThat(e.getMessage(), containsString("line 2:5: Unbounded sort not supported yet, please add a limit"));
7466+
assertThat(e.getMessage(), containsString("line 2:5: Unbounded sort not supported yet [SORT y] please add a limit"));
74677467
}
74687468

74697469
public void testUnboundedSortWithMvExpandAndFilter() {
@@ -7478,7 +7478,7 @@ public void testUnboundedSortWithMvExpandAndFilter() {
74787478
""";
74797479

74807480
VerificationException e = expectThrows(VerificationException.class, () -> plan(query));
7481-
assertThat(e.getMessage(), containsString("line 4:3: Unbounded sort not supported yet, please add a limit"));
7481+
assertThat(e.getMessage(), containsString("line 4:3: Unbounded sort not supported yet [SORT language_name] please add a limit"));
74827482
}
74837483

74847484
public void testUnboundedSortWithLookupJoinAndFilter() {
@@ -7493,7 +7493,19 @@ public void testUnboundedSortWithLookupJoinAndFilter() {
74937493
""";
74947494

74957495
VerificationException e = expectThrows(VerificationException.class, () -> plan(query));
7496-
assertThat(e.getMessage(), containsString("line 5:3: Unbounded sort not supported yet, please add a limit"));
7496+
assertThat(e.getMessage(), containsString("line 5:3: Unbounded sort not supported yet [SORT foo] please add a limit"));
7497+
}
7498+
7499+
public void testUnboundedSortExpandFilter() {
7500+
var query = """
7501+
ROW x = [1,2,3], y = 1
7502+
| SORT x
7503+
| MV_EXPAND x
7504+
| WHERE x > 2
7505+
""";
7506+
7507+
VerificationException e = expectThrows(VerificationException.class, () -> plan(query));
7508+
assertThat(e.getMessage(), containsString("line 2:5: Unbounded sort not supported yet [SORT x] please add a limit"));
74977509
}
74987510

74997511
}

0 commit comments

Comments
 (0)