[
https://issues.apache.org/jira/browse/CALCITE-7077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17986828#comment-17986828
]
xiong duan commented on CALCITE-7077:
-------------------------------------
After discussion in the PR, it was finally rewritten as:
{code:java}
SELECT * FROM a FULL JOIN b ON c
==>
SELECT * FROM a LEFT JOIN b ON c
UNION ALL
SELECT * FROM a RIGHT JOIN b ON c WHERE c IS NOT TRUE{code}
If no other failed test cases are found, this logic will be implemented.
The unit test case in https://onecompiler.com/postgresql/43p9qnpqa
> Implement a rule to rewrite FULL JOIN as LEFT JOIN and RIGHT JOIN
> -----------------------------------------------------------------
>
> Key: CALCITE-7077
> URL: https://issues.apache.org/jira/browse/CALCITE-7077
> Project: Calcite
> Issue Type: New Feature
> Reporter: Zhen Chen
> Assignee: Zhen Chen
> Priority: Minor
>
> Invalid unparse for FULL JOIN in MySQLDialect is described in CALCITE-7050.
> The purpose is to allow SQL dialects that do not support FULL JOIN to execute
> according to the semantics of FULL JOIN. For this, a rule can be implemented
> to rewrite FULL JOIN into LEFT JOIN and RIGHT JOIN. For example:
> original sql:
> {code:java}
> SELECT *
> FROM Employees e
> FULL JOIN Departments d ON e.id = d.id
> {code}
> rewrite into
> {code:java}
> SELECT *
> FROM Employees e
> LEFT JOIN Departments d ON e.id = d.id
> UNION ALL
> SELECT *
> FROM Employees e
> RIGHT JOIN Departments d ON e.id = d.id
> where e.id is null;
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)