Skip to content

Commit 79ef263

Browse files
authored
Add test with alias reuse and grouping (#60396) (#60421)
Add test with alias reuse and grouping. (cherry picked from commit 37ee819)
1 parent 5359417 commit 79ef263

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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
@@ -633,6 +633,11 @@ public void testGroupByOrderByScore() {
633633
error("SELECT int FROM test GROUP BY int ORDER BY SCORE()"));
634634
}
635635

636+
public void testGroupByWithRepeatedAliases() {
637+
accept("SELECT int as x, keyword as x, max(date) as a FROM test GROUP BY 1, 2");
638+
accept("SELECT int as x, keyword as x, max(date) as a FROM test GROUP BY int, keyword");
639+
}
640+
636641
public void testHavingOnColumn() {
637642
assertEquals("1:42: Cannot use HAVING filter on non-aggregate [int]; use WHERE instead",
638643
error("SELECT int FROM test GROUP BY int HAVING int > 2"));

0 commit comments

Comments
 (0)