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 2021/12/22 09:02:42 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_r773717100



##########
File path: core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
##########
@@ -5972,7 +5972,9 @@ protected SqlNode visitScoped(SqlCall call) {
         int n = 0;
         for (SqlNode s : select.getSelectList()) {
           final String alias = SqlValidatorUtil.getAlias(s, -1);
-          if (alias != null && nameMatcher.matches(alias, name)) {
+          if (alias != null && nameMatcher.matches(alias, name)
+              && s instanceof SqlBasicCall //only "expr as alias" need expand, but A as A no need
+              && !s.hasUnderlyingColumnSameAsAlias(alias)) {
             expr = s;

Review comment:
       done

##########
File path: core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java
##########
@@ -8723,6 +8723,61 @@ public void subTestIntervalSecondFailsValidation() {
     sql(sql3).ok(expected3);
   }
 
+  @Test public void testGroupByAlias1() {
+    conformance = SqlConformanceEnum.LENIENT;
+    final String sql = "select price,price\n"

Review comment:
       done




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org