Skip to content

Commit 67e64d2

Browse files
committed
Update tests
1 parent 931b526 commit 67e64d2

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,10 +2124,26 @@ public void testChangePoint_valueNumeric() {
21242124
}
21252125

21262126
public void testSortByAggregate() {
2127-
assertEquals("1:18: Aggregate functions are not allowed in SORT [COUNT]", error("ROW a = 1 | SORT count(*)"));
2128-
assertEquals("1:28: Aggregate functions are not allowed in SORT [COUNT]", error("ROW a = 1 | SORT to_string(count(*))"));
2129-
assertEquals("1:22: Aggregate functions are not allowed in SORT [MAX]", error("ROW a = 1 | SORT 1 + max(a)"));
2130-
assertEquals("1:18: Aggregate functions are not allowed in SORT [COUNT]", error("FROM test | SORT count(*)"));
2127+
assertEquals("1:18: aggregate function [count(*)] not allowed outside STATS command", error("ROW a = 1 | SORT count(*)"));
2128+
assertEquals(
2129+
"1:28: aggregate function [count(*)] not allowed outside STATS command",
2130+
error("ROW a = 1 | SORT to_string(count(*))")
2131+
);
2132+
assertEquals("1:22: aggregate function [max(a)] not allowed outside STATS command", error("ROW a = 1 | SORT 1 + max(a)"));
2133+
assertEquals("1:18: aggregate function [count(*)] not allowed outside STATS command", error("FROM test | SORT count(*)"));
2134+
}
2135+
2136+
public void testFilterByAggregate() {
2137+
assertEquals("1:19: aggregate function [count(*)] not allowed outside STATS command", error("ROW a = 1 | WHERE count(*) > 0"));
2138+
assertEquals(
2139+
"1:29: aggregate function [count(*)] not allowed outside STATS command",
2140+
error("ROW a = 1 | WHERE to_string(count(*)) IS NOT NULL")
2141+
);
2142+
assertEquals("1:23: aggregate function [max(a)] not allowed outside STATS command", error("ROW a = 1 | WHERE 1 + max(a) > 0"));
2143+
assertEquals(
2144+
"1:24: aggregate function [min(languages)] not allowed outside STATS command",
2145+
error("FROM employees | WHERE min(languages) > 2")
2146+
);
21312147
}
21322148

21332149
public void testLookupJoinDataTypeMismatch() {

0 commit comments

Comments
 (0)