[
https://issues.apache.org/jira/browse/CALCITE-7072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mihai Budiu reassigned CALCITE-7072:
------------------------------------
Assignee: Mihai Budiu
> Validator should not insert aliases on subexpressions
> -----------------------------------------------------
>
> Key: CALCITE-7072
> URL: https://issues.apache.org/jira/browse/CALCITE-7072
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.40.0
> Reporter: Mihai Budiu
> Assignee: Mihai Budiu
> Priority: Minor
>
> For the following program
> {code:sql}
> SELECT CASE WHEN deptno IS NOT NULL THEN empno
> ELSE CAST(deptno AS VARCHAR) END AS ID FROM emp
> {code}
> type coercion may insert an alias for the "empno" expression, producing SQL
> such as:
> {code:sql}
> CASE WHEN `EMP`.`DEPTNO` IS NOT NULL THEN CAST(`EMP`.`EMPNO` AS VARCHAR`) AS
> `EMPNO` ELSE ...
> {code}
> which is clearly incorrect.
> This bug was reported by github user rongrong. It was introduced in
> [CALCITE-6770]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)