You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SQL: Allow look-ahead resolution of aliases for WHERE clause (#38450)
Aliases defined in SELECT (Project or Aggregate) are now resolved in the
following WHERE clause. The Analyzer has been enhanced to identify this
rule and replace the field accordingly.
Close#29983
(cherry picked from commit 1a02445)
Copy file name to clipboardExpand all lines: x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java
+12-1Lines changed: 12 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -638,5 +638,16 @@ public void testMaxOnKeywordGroupByHavingUnsupported() {
638
638
assertEquals("1:52: HAVING filter is unsupported for function [MAX(keyword)]",
639
639
error("SELECT MAX(keyword) FROM test GROUP BY text HAVING MAX(keyword) > 10"));
640
640
}
641
-
}
642
641
642
+
publicvoidtestProjectAliasInFilter() {
643
+
accept("SELECT int AS i FROM test WHERE i > 10");
644
+
}
645
+
646
+
publicvoidtestAggregateAliasInFilter() {
647
+
accept("SELECT int AS i FROM test WHERE i > 10 GROUP BY i HAVING MAX(i) > 10");
648
+
}
649
+
650
+
publicvoidtestProjectUnresolvedAliasInFilter() {
651
+
assertEquals("1:8: Unknown column [tni]", error("SELECT tni AS i FROM test WHERE i > 10 GROUP BY i"));
0 commit comments