You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "bingfeng.guo (Jira)" <ji...@apache.org> on 2021/12/22 09:52:00 UTC

[jira] [Commented] (CALCITE-3589) SqlValidatorException when conformation is set to LENIENT

    [ https://issues.apache.org/jira/browse/CALCITE-3589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17463691#comment-17463691 ] 

bingfeng.guo commented on CALCITE-3589:
---------------------------------------

[~julianhyde] 

You are right, "only when the underlying column and alias exist at the same time, group by the underlying column" does not explain why Q5 fails, there is a problem with this theory, I added a Q5 in UT, and it failed

At present, this fix of mine can only solve the problem that the following SQL succeeds in PG but fails in calcite
{quote}select a + 1 a from test group by a + 1;
{quote}

> SqlValidatorException when conformation is set to LENIENT
> ---------------------------------------------------------
>
>                 Key: CALCITE-3589
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3589
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: bingfeng.guo
>            Assignee: bingfeng.guo
>            Priority: Critical
>              Labels: pull-request-available
>         Attachments: 屏幕快照 2019-12-12 下午5.56.24.png
>
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> error occurs conditions (all three conditions must be met):
>  * conformance = LENIENT
>  * The alias of the expression in select is the same as the column name of the column used in the expression
>  * group by or having use the above expression
> {color:#172b4d}a simple example is as follows:{color}
> {color:#ff8b00}SELECT SELLER_ID + 1 AS SELLER_ID, sum(PRICE){color}
>  {color:#ff8b00}FROM TEST_KYLIN_FACT{color}
>  {color:#ff8b00}GROUP BY SELLER_ID + 1{color}
> {color:#172b4d}will change to {color}
> {color:#ff8b00}SELECT SELLER_ID + 1 AS SELLER_ID, sum(PRICE){color}
> {color:#ff8b00} FROM TEST_KYLIN_FACT{color}
> {color:#ff8b00} GROUP BY SELLER_ID + 1 + 1{color}
> {color:#172b4d}after org.apache.calcite.sql.validate.SqlValidatorImpl#expandGroupByOrHavingExpr{color}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)