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

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

 

@[~julianhyde] Thanks for your review,Are you considering the following 
situations?

1.

 
{code:java}
select tableA.C+1 as A_C,tableB.C+1 as B_C
from tableA,tableB
group by A_C,B_C
{code}
A_C will still replace to  tableA.C+1,like this
{code:java}
select tableA.C as A_C,tableB.C as B_C
from tableA,tableB
group by tableA.C,tableB.C
{code}
 because only when tableA.C same with A_C in"tableA.C+1 as A_C" will not replace

 

 

 

2.
{code:java}
select tableA.C+1 as A_C,tableB.C+1 as B_C 
from tableA,tableB 
group by tableA.C+1,tableB.C+1
{code}
it need not replace.

 

 3.
{code:java}
select tableA.C+tableB.C as C
from tableA,tableB
group by C
{code}
C will still replace to tableA.C+tableB.C, like this
{code:java}
select tableA.C+tableB.C as C
from tableA,tableB
group by tableA.C+tableB.C
{code}
 

 

 

 

 

 

 

 

 

 

> 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: 40m
>  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.3.4#803005)

Reply via email to