You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Abbas Gadhia (Jira)" <ji...@apache.org> on 2023/02/15 14:58:00 UTC
[jira] [Created] (CALCITE-5530) RelToSqlConverter[ORDER BY] generates an incorrect field alias when 2 projection fields have the same name
Abbas Gadhia created CALCITE-5530:
-------------------------------------
Summary: RelToSqlConverter[ORDER BY] generates an incorrect field alias when 2 projection fields have the same name
Key: CALCITE-5530
URL: https://issues.apache.org/jira/browse/CALCITE-5530
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.33.0
Reporter: Abbas Gadhia
In queries typical of Teradata,
if there exists an expression alias that is also a field in the underlying table, any references to that field in the ORDER BY, refer to the underlying physical column rather than the expression alias.
For ex. in the following query and Rel
{code:java}
SELECT UPPER(ENAME) AS EMPNO FROM scott.EMP order by EMPNO;{code}
{noformat}
LogicalProject(EMPNO=[$0])
LogicalSort(sort0=[$1], dir0=[ASC])
LogicalProject(EMPNO=[UPPER($1)], EMPNO0=[$0])
LogicalTableScan(table=[[scott, EMP]])
{noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)