Skip to content

Commit c7d867c

Browse files
committed
Update tests
1 parent 763b3b8 commit c7d867c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,33 @@ public void testFilterByAggregate() {
21402140
);
21412141
}
21422142

2143+
public void testDissectByAggregate() {
2144+
assertEquals(
2145+
"1:21: aggregate function [min(first_name)] not allowed outside STATS command",
2146+
error("from test | dissect min(first_name) \"%{foo}\"")
2147+
);
2148+
assertEquals(
2149+
"1:21: aggregate function [avg(salary)] not allowed outside STATS command",
2150+
error("from test | dissect avg(salary) \"%{foo}\"")
2151+
);
2152+
}
2153+
2154+
public void testGrokByAggregate() {
2155+
assertEquals(
2156+
"1:18: aggregate function [max(last_name)] not allowed outside STATS command",
2157+
error("from test | grok max(last_name) \"%{WORD:foo}\"")
2158+
);
2159+
assertEquals(
2160+
"1:18: aggregate function [sum(salary)] not allowed outside STATS command",
2161+
error("from test | grok sum(salary) \"%{WORD:foo}\"")
2162+
);
2163+
}
2164+
2165+
public void testAggregateInRow() {
2166+
assertEquals("1:13: aggregate function [count(*)] not allowed outside STATS command", error("ROW a = 1 + count(*)"));
2167+
assertEquals("1:9: aggregate function [avg(2)] not allowed outside STATS command", error("ROW a = avg(2)"));
2168+
}
2169+
21432170
public void testLookupJoinDataTypeMismatch() {
21442171
assumeTrue("requires LOOKUP JOIN capability", EsqlCapabilities.Cap.JOIN_LOOKUP_V12.isEnabled());
21452172

0 commit comments

Comments
 (0)