You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/08/19 10:32:57 UTC

[GitHub] [calcite] whuGuo commented on a change in pull request #1664: [CALCITE-3589] SqlValidatorException when conformation is set to LENIENT

whuGuo commented on a change in pull request #1664:
URL: https://github.com/apache/calcite/pull/1664#discussion_r472929169



##########
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:
       yes, it is.  when isGroupByAlias=true, it means you will group by alias, not the underlying column.
   
   after the fix, such SQL will not has SqlValidatorException,because it will think DEPTNO on group by as a basic column, not a alias
   ```sql select DEPTNO+1 as DEPTNO from emp group by DEPTNO+1 ```
   
   before the fix, it think DEPTNO on group by is a alias
   
   thank your review




----------------------------------------------------------------
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:
users@infra.apache.org