Skip to content

Commit efb8a96

Browse files
committed
Eliminate SCORE() from supported ORDER BYs
1 parent b4bb8b7 commit efb8a96

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/analysis/analyzer/Verifier.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,6 @@ private static boolean checkGroupByOrder(LogicalPlan p, Set<Failure> localFailur
237237
Map<Expression, Node<?>> missing = new LinkedHashMap<>();
238238
o.order().forEach(oe -> {
239239
Expression e = oe.child();
240-
// skip score
241-
if (e instanceof Score) {
242-
return;
243-
}
244240
// cannot order by aggregates (not supported by composite)
245241
if (Functions.isAggregate(e)) {
246242
missing.put(e, oe);

x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,9 @@ public void testGroupByOrderByFunctionOverKey() {
154154
assertEquals("1:44: Cannot order by non-grouped column [MAX(int)], expected [int]",
155155
verify("SELECT int FROM test GROUP BY int ORDER BY MAX(int)"));
156156
}
157+
158+
public void testGroupByOrderByScore() {
159+
assertEquals("1:44: Cannot order by non-grouped column [SCORE()], expected [int]",
160+
verify("SELECT int FROM test GROUP BY int ORDER BY SCORE()"));
161+
}
157162
}

0 commit comments

Comments
 (0)