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

Julian Hyde commented on CALCITE-7085:
--------------------------------------

Please upper-case SQL keywords JOIN and USING in summary.

In summary mention that this only occurs in a conformance where 
{{allowQualifyingCommonColumn}} is false (e.g. Oracle, Presto).

It seems fishy that the {{allowQualifyingCommonColumn}} check is performed 
AFTER expansion has occurred. Because we are validating the expanded 
expression, not what the user wrote. I wonder whether the check can be moved 
earlier.

> Join Using with unqualified common column fails when disallows qualifying 
> common column
> ---------------------------------------------------------------------------------------
>
>                 Key: CALCITE-7085
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7085
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Viggo Chen
>            Priority: Major
>
> SeeĀ SqlToRelConverterTest [test case 
> |https://github.com/apache/calcite/commit/7990aa521103f4af1f690dd5152b972f69df0a0b]
> {code:java}
> // FIXME: fails with "Cannot qualify common column 'EMP.DEPTNO'"
> @Test void 
> testJoinUsingWithUnqualifiedCommonColumnWhenDisallowsQualifyingCommonColumn() 
> {
>   final String sql = "SELECT deptno, name\n"
>       + "FROM emp JOIN dept using (deptno)";
>   sql(sql).withConformance(SqlConformanceEnum.ORACLE_10).ok();
> } {code}
> deptno is expanded to COALESCE(`EMP`.`DEPTNO`, `DEPT`.`DEPTNO`) AS `DEPTNO` 
> and fails because ORACLE disallows qualifying common column



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

Reply via email to