whuGuo commented on a change in pull request #1664:
URL: https://github.com/apache/calcite/pull/1664#discussion_r473626228
##########
File path: core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java
##########
@@ -11236,6 +11236,35 @@ private void checkCustomColumnResolving(String table) {
assertThat(resultType.toString(), is("INTEGER"));
}
+ @Test public void testGroupByAlias() {
+ // test group by alias, when the underlying column in the expression is
the same as the alias
+ sql("select DEPTNO+1 as DEPTNO from emp group by DEPTNO+1")
+ .withConformance(SqlConformanceEnum.LENIENT)
+ .ok();
Review comment:
When I run the following two SQLs on PG, I found that PG will not throw
Exception, so I think that PG does not strictly stipulate whether it is group
by alias or group by underlying column . I think it is the priority group
byunderlying column, if there is no underlying column, then group by alias.
``` select empno as d from emp group by d ```
``` select empno as d from emp group by empno```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]