You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/10/01 18:43:13 UTC

[jira] [Commented] (CALCITE-2602) Support inner join without on-condition

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

Julian Hyde commented on CALCITE-2602:
--------------------------------------

It doesn't seem to be a very useful feature. Instead of {code} select * from emp join dept where emp.deptno = dept.deptno{code} you can write {code}select * from emp cross join dept where emp.deptno = dept.deptno{code} or {code} select * from emp, dept where emp.deptno = dept.deptno{code}

As it is non-standard and has two standard alternatives, I think this would be better in Babel than in Calcite's core parser.

It looks as if the syntax is ambiguous; in {code}select * from emp join dept join location on dept.locationId = location.locationId{code} it is not clear whether the {{on}} clause applies to {{(emp join dept) join location}} or just {{dept join location}}. A similar ambiguity, called a shift-reduce conflict, occurs in languages in the C family, including Java: {code}if (e1) if (e2) s1 else s2{code} could be resolved to either {code} if (e1) { if (e2) s1 } else s2{code} or to{code}if (e1) { if (e2) s1 else s2 }{code} but by convention is resolved to the latter. That ambiguity might make the parser a bit harder to write, and we would need to specify which behavior we intend, and write tests for it.

> Support inner join without on-condition
> ---------------------------------------
>
>                 Key: CALCITE-2602
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2602
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: pengzhiwei
>            Assignee: Julian Hyde
>            Priority: Major
>
> Currently,calcite cannot support sql as follow:
> {code:java}
> select * from emp join dept where emp.deptno = dept.deptno{code}
> However in mysql and hive, such sql runs well.Should we support this kind of inner join without on-condition?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)