Add test with alias reuse and grouping (#60396) (#60421)

Add test with alias reuse and grouping.

(cherry picked from commit 37ee819eb98fd10c1b16a61e4e1d446d0ee859de)
This commit is contained in:
Bogdan Pintea 2020-07-29 20:43:04 +02:00 committed by GitHub
parent 5359417ec3
commit 79ef263fc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -633,6 +633,11 @@ public class VerifierErrorMessagesTests extends ESTestCase {
error("SELECT int FROM test GROUP BY int ORDER BY SCORE()"));
}
public void testGroupByWithRepeatedAliases() {
accept("SELECT int as x, keyword as x, max(date) as a FROM test GROUP BY 1, 2");
accept("SELECT int as x, keyword as x, max(date) as a FROM test GROUP BY int, keyword");
}
public void testHavingOnColumn() {
assertEquals("1:42: Cannot use HAVING filter on non-aggregate [int]; use WHERE instead",
error("SELECT int FROM test GROUP BY int HAVING int > 2"));