[
https://issues.apache.org/jira/browse/CALCITE-5547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17719054#comment-17719054
]
Julian Hyde commented on CALCITE-5547:
--------------------------------------
The following queries should return the same columns:
{noformat}
> select empno as two, * from emp natural join dept;
+---------+------+-------+--------+-----------+------+------------+---------+---------+------------+
| COMM | TWO | EMPNO | ENAME | JOB | MGR | HIREDATE | SAL |
DEPTNO0 | DNAME |
+---------+------+-------+--------+-----------+------+------------+---------+---------+------------+
| 20.00 | 7369 | 7369 | SMITH | CLERK | 7902 | 1980-12-17 | 800.00 |
20 | RESEARCH |
...
> select empno+1 as two, * from emp natural join dept;
+------+--------+-------+--------+-----------+------+------------+---------+---------+------------+----------+
| TWO | DEPTNO | EMPNO | ENAME | JOB | MGR | HIREDATE | SAL |
COMM | DNAME | LOC |
+------+--------+-------+--------+-----------+------+------------+---------+---------+------------+----------+
| 7370 | 20 | 7369 | SMITH | CLERK | 7902 | 1980-12-17 | 800.00 |
null | RESEARCH | DALLAS |
...
{noformat}
The first query is wrong, and I think it trips up because {{empno}} is an
identifier, and therefore looks as if it came from the expanded {{*}}.
> JOIN USING returns incorrect column names
> -----------------------------------------
>
> Key: CALCITE-5547
> URL: https://issues.apache.org/jira/browse/CALCITE-5547
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.33.0
> Reporter: Sean Broeder
> Assignee: Jiajun Xie
> Priority: Major
> Labels: pull-request-available
>
> The query
> {code:java}
> SELECT '' as \"xxx\", *
> FROM (values (1, 4, 'one')) as t1(i ,j ,t )
> LEFT JOIN (values (1, -1)) as t2(i ,k )
> USING (i) {code}
> returns columns (xxx, i, j, i0),
> but should return columns (xxx, i, j, t, k)
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)