You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Danny Chen (Jira)" <ji...@apache.org> on 2020/02/24 02:14:00 UTC

[jira] [Resolved] (CALCITE-3811) JDBC adapter generates SQL with invalid field names if Filter's row type is different from its input

     [ https://issues.apache.org/jira/browse/CALCITE-3811?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Danny Chen resolved CALCITE-3811.
---------------------------------
    Resolution: Fixed

Fixed in [f8a0f0d|https://github.com/apache/calcite/commit/f8a0f0d503e6844c0ec14423e72e97aaf804d87b] !

> JDBC adapter generates SQL with invalid field names if Filter's row type is different from its input
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-3811
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3811
>             Project: Calcite
>          Issue Type: Bug
>          Components: jdbc-adapter
>    Affects Versions: 1.21.0
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.22.0
>
>
> JDBC adapter generates SQL with invalid field names if a {{Filter}} object's row type is different from its input. Usually a {{Filter}} object's row type is identical to its input's row type (because that is how it derives its row type on construction), but if you call {{RelNode.replaceInput}} after construction it is possible to make the field names inconsistent.
> Here is an example of the wrong SQL generated:
> {code}
> SELECT D AS `emps.deptno`
> FROM (
>   SELECT DEPTNO AS D2, COUNT(*) AS `emps.count`
>   FROM `scott`.EMP
>   GROUP BY DEPTNO
>   HAVING COUNT(*) < 2) AS `t1`
> {code}
> Note that the sub-query returns a column {{D2}} but the outer {{SELECT}} expression refers to {{D}}, because that was the name in the row type of the {{Filter}} (which became the {{HAVING}} clause in the generated SQL).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)