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

Keuntae Park edited comment on TAJO-1518 at 4/7/15 8:49 AM:
------------------------------------------------------------

Unlike UNION and UNION ALL, INTERSECT and INTERSECT ALL,
EXCEPT is not equal to EXCEPT ALL + distinct.

For example, when query1 returns {{1, 2, 3, 1, 3, 4}} while query2 returns {{1, 
3, 5}},
query1 EXCEPT query2 returns {{2, 4}}
but query1 EXCEPT ALL query2 returns {{2, 1, 3, 4}}.

Actually, {{query1 EXCEPT query2}} is {{distinct(distinct query1 EXCEPT ALL 
distinct query2).}}
However, it is too complex so that it is more simple to implement EXCEPT as 
ANTI JOIN + distinct.

I think EXCEPT ALL needs implementation of new physical operator like INTERSECT 
ALL
while EXCEPT can be implemented by ANTI JOIN + distinct.


was (Author: sirpkt):
Unlike UNION and UNION ALL, INTERSECT and INTERSECT ALL,
EXCEPT is not equal to EXCEPT ALL + distinct.

For example, when query1 returns {1, 2, 3, 1, 3, 4} while query2 returns {1, 3, 
5},
query1 EXCEPT query2 returns {2, 4}
but query1 EXCEPT ALL query2 returns {2, 1, 3, 4}.

Actually, query1 EXCEPT query2 is {{distinct(distinct query1 EXCEPT ALL 
distinct query2).}}
However, it is too complex so that it is more simple to implement EXCEPT as 
ANTI JOIN + distinct.

I think EXCEPT ALL needs implementation of new physical operator like INTERSECT 
ALL
while EXCEPT can be implemented by ANTI JOIN + distinct.

> Implement EXCEPT
> ----------------
>
>                 Key: TAJO-1518
>                 URL: https://issues.apache.org/jira/browse/TAJO-1518
>             Project: Tajo
>          Issue Type: Sub-task
>            Reporter: Keuntae Park
>
> {code}
> query1 EXCEPT [ALL] query2
> {code}
> EXCEPT returns all rows that are in the result of query1 but not in the 
> result of query2.
> Duplicates are eliminated unless EXCEPT ALL is used.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to