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

duan xiong commented on CALCITE-4486:
-------------------------------------

[~julianhyde] Thank you for your advice. Only one I want to confirm about the 
Null value.
 * Are there any tests where null values are involved? I believe that null is 
treated like other values - i.e. \{null, 1} is unique, \{null, null, 1} is not 
unique. But we should have tests.

 according to [UNIQUE 
Presicate|[https://www.jooq.org/doc/3.0/manual/sql-building/conditional-expressions/unique-predicate/]]
 about Null Values. It ignored the row that includes NULL value. So I create 
notNullCondition to filter the rows out that include NULL value.

> UNIQUE predicate
> ----------------
>
>                 Key: CALCITE-4486
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4486
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: duan xiong
>            Priority: Major
>
> Implement the UNIQUE predicate, as specified by the SQL standard.
> Example:
> {code:java}
> UNIQUE (SELECT publishedIn FROM Book
>             WHERE authorId = 3)
> NOT UNIQUE (SELECT publishedIn FROM BOOK
>             WHERE authorId = 3)
> {code}
> {{UNIQUE}} returns {{FALSE}} if the query returns two or more rows that do 
> not include NULL values and are equal. Like {{EXISTS}}, it never returns 
> {{UNKNOWN}}.
> More details at 
> [JOOQ|https://www.jooq.org/doc/3.0/manual/sql-building/conditional-expressions/unique-predicate/].
> This Issue support the UNIQUE predicate by set {{isExpand}} to return false, 
> so sub-queries are converted to {{RexSubQuery}} expressions and handled later 
> by {{SubQueryRemoveRule}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to