[ 
https://issues.apache.org/jira/browse/CALCITE-5253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17597849#comment-17597849
 ] 

Evgeny Stanilovsky commented on CALCITE-5253:
---------------------------------------------

The problem that is after first [t1, t2] join validation is completed, the 
final RelDataType rowType = namespace.getRowType(); 
will becomes the cartesian product i.e. RelCrossType with possible 2 or more 
equal column names, thus 
[nameMatcher.frequency(rowType.getFieldNames(), name) > 
1)|https://github.com/zstan/calcite/blob/8e67d9c79846d0a15a57ef56fccb7011c69fa26f/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3609]
 will become True
SqlValidatorImpl#validateCommonInputJoinColumn 

> Natural join fields validation partially broken after CALCITE-5171
> ------------------------------------------------------------------
>
>                 Key: CALCITE-5253
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5253
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.31.0
>            Reporter: Evgeny Stanilovsky
>            Assignee: Evgeny Stanilovsky
>            Priority: Major
>
> Such issue is not possible for now: 
> {code:java}
> CREATE TABLE t1(a INTEGER, b INTEGER, c INTEGER);
> CREATE TABLE t2(b INTEGER, c INTEGER, d INTEGER);
> CREATE TABLE t3(c INTEGER, d INTEGER, e INTEGER);
> SELECT t1.c, t2.d, t1.b, t1.a, t3.e FROM t1 natural join t2 natural join t3 
> WHERE t1.a=1;
> {code}
> cause:
> {noformat}
> SqlValidatorException: Column name 'C' in NATURAL join or USING clause is not 
> unique on one side of join
> {noformat}
> Was broken by:
> [1] https://issues.apache.org/jira/browse/CALCITE-5171
> So this is a regression.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to