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

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

                Author: ASF GitHub Bot
            Created on: 15/Jan/19 00:04
            Start Date: 15/Jan/19 00:04
    Worklog Time Spent: 10m 
      Work Description: akedin commented on pull request #7504: [BEAM-6427] 
INTERSECT ALL is not compatible with SQL standard.
URL: https://github.com/apache/beam/pull/7504#discussion_r247713398
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamSetOperatorsTransforms.java
 ##########
 @@ -80,8 +80,23 @@ public void processElement(ProcessContext ctx) {
         case INTERSECT:
           if (leftRows.iterator().hasNext() && rightRows.iterator().hasNext()) 
{
             if (all) {
-              for (Row leftRow : leftRows) {
-                ctx.output(leftRow);
+              Iterator<Row> iter = leftRows.iterator();
+              int leftCount = 0;
+              int rightCount = 0;
+              while (iter.hasNext()) {
+                iter.next();
+                leftCount++;
+              }
 
 Review comment:
   I think guava has `Iterators.size(iterator)`
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 185037)
    Time Spent: 0.5h  (was: 20m)

> INTERSECT ALL is not compatible with SQL standard
> -------------------------------------------------
>
>                 Key: BEAM-6427
>                 URL: https://issues.apache.org/jira/browse/BEAM-6427
>             Project: Beam
>          Issue Type: Improvement
>          Components: dsl-sql
>            Reporter: Rui Wang
>            Assignee: Rui Wang
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> say Row R appears m times on one side and n times on another side. 
> Beam's  INTERSECT ALL is implemented to return MAX(m, n).
> And SQL1999 standard says INTERSECT ALL should return MIN(m, n).



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

Reply via email to