[ 
https://issues.apache.org/jira/browse/CALCITE-3012?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jesus Camacho Rodriguez resolved CALCITE-3012.
----------------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.20.0

Fixed in 
[9ece70f5dcdb00dbc6712496c51f52c05178d4aa|https://github.com/apache/calcite/commit/9ece70f5dcdb00dbc6712496c51f52c05178d4aa].
 Thanks [~vgarg]!

> Column uniqueness metadata provider may return wrong result for FULL OUTER 
> JOIN operator
> ----------------------------------------------------------------------------------------
>
>                 Key: CALCITE-3012
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3012
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Vineet Garg
>            Assignee: Vineet Garg
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.20.0
>
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> Let's say set of columns passed to this API are join keys and there is one 
> NULL key coming from both the inputs. Following code will return true which 
> is wrong because the result of FULL. OUTER JOIN with NULL key on both side 
> will produce two rows with NULL. Even though this value in respective input 
> is unique the result of join may not be unique.
> {code:java}
>  Boolean leftUnique = mq.areColumnsUnique(left, leftColumns, ignoreNulls);
>     Boolean rightUnique = mq.areColumnsUnique(right, rightColumns, 
> ignoreNulls);
>     if ((leftColumns.cardinality() > 0)
>         && (rightColumns.cardinality() > 0)) {
>       if ((leftUnique == null) || (rightUnique == null)) {
>         return null;
>       } else {
>         return leftUnique && rightUnique;
>       }
>     }
> {code}
> {code:sql}
> create table trepro(i int);
> insert into trepro values(null);
> select * from trepro t1 full outer join trepro t2 on t1.i=t2.i;
> null, null
> null, null
> {code}



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

Reply via email to