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

Jess Balint commented on CALCITE-1636:
--------------------------------------

Fixed in 
http://git-wip-us.apache.org/repos/asf/calcite/commit/f7d29063b3a323b21968125f5aea16a0d33a39e6.
 Thanks for the PR, Zhiqiang He!

> JDBC adapter generates wrong SQL for self join with sub-query
> -------------------------------------------------------------
>
>                 Key: CALCITE-1636
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1636
>             Project: Calcite
>          Issue Type: Bug
>          Components: jdbc-adapter
>    Affects Versions: 1.11.0
>            Reporter: Zhiqiang He
>            Assignee: Zhiqiang He
>
> JDBC adapter generates wrong SQL when selft join with subquery when DB2 
> dialect used .
> input sql
>  {code:sql}
> select t1."customer_id", t2."customer_id" 
>   from (select "customer_id" from "sales_fact_1997") as t1 
>   inner join (select "customer_id" from "sales_fact_1997") t2 
>   on t1."customer_id" = t2."customer_id"
>  {code}
> output sql
>  {code:sql}
> SELECT *
> FROM (SELECT sales_fact_1997.customer_id
> FROM foodmart.sales_fact_1997 AS sales_fact_1997) AS t
> INNER JOIN (SELECT sales_fact_19970.customer_id
> FROM foodmart.sales_fact_1997 AS sales_fact_19970) AS t0 ON 
> sales_fact_1997.product_id = sales_fact_19970.product_id
>  {code}
>  sales_fact_1997.product_id = sales_fact_19970.product_id is wrong, can not 
> found tables sales_fact_1997 and sales_fact_19970 in ON condition.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to