[ 
https://issues.apache.org/jira/browse/BEAM-7194?focusedWorklogId=235941&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-235941
 ]

ASF GitHub Bot logged work on BEAM-7194:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/May/19 18:37
            Start Date: 01/May/19 18:37
    Worklog Time Spent: 10m 
      Work Description: TheNeuralBit commented on pull request #8447: 
[BEAM-7194] EXCEPT DISTINCT behavior when right set contains a value is 
incorrect
URL: https://github.com/apache/beam/pull/8447#discussion_r280169297
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamSetOperatorsTransforms.java
 ##########
 @@ -97,8 +97,10 @@ public void processElement(ProcessContext ctx) {
           }
           break;
         case MINUS:
-          // Say for Row R, there are m instances on left and n instances on 
right,
-          // EXCEPT ALL outputs MAX(m - n, 0) instances of R.
+          // Say for Row R, there are m instances on left and n instances on 
right:
+          // - EXCEPT ALL outputs MAX(m - n, 0) instances of R.
+          // - EXCEPT DISTINCT and EXCEPT output a single instance of R if m > 
0 and n == 0, else
 
 Review comment:
   Discussed this a bit offline. It looks like the default in Calcite [is in 
fact `EXCEPT 
DISTINCT`](https://github.com/apache/calcite/blob/master/core/src/main/codegen/templates/Parser.jj#L6011),
 and it's actually not mentioned on the calcite reference page. The line we 
were both referencing says that `MULTISET EXCEPT` defaults to all. It doesn't 
seem to specify `EXCEPT`'s default behavior anywhere.
   
   I'm going to change this comment to `EXCEPT ALL` and `EXCEPT [DISTINCT]` and 
resolve this.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 235941)
    Time Spent: 1h 10m  (was: 1h)

> EXCEPT DISTINCT behavior when right set contains a value is incorrect
> ---------------------------------------------------------------------
>
>                 Key: BEAM-7194
>                 URL: https://issues.apache.org/jira/browse/BEAM-7194
>             Project: Beam
>          Issue Type: Bug
>          Components: dsl-sql
>            Reporter: Brian Hulette
>            Assignee: Brian Hulette
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> (1, 2, 3, 1) EXCEPT DISTINCT (1) should yield (2, 3), not (1,2,3)



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

Reply via email to