[
https://issues.apache.org/jira/browse/CALCITE-7072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mihai Budiu resolved CALCITE-7072.
----------------------------------
Fix Version/s: 1.41.0
Resolution: Fixed
Fixed in
[https://github.com/apache/calcite/commit/b5057b7bd5192bdb723808af75612e06f55afc4f]
Thank you for the bug report and review [~rongrong]
> 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
> Labels: pull-request-available
> Fix For: 1.41.0
>
>
> 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)