Ruben Q L created CALCITE-3539:
----------------------------------

             Summary: EnumerableDefaults#nestedLoopJoin returns duplicates for 
JoinType.SEMI
                 Key: CALCITE-3539
                 URL: https://issues.apache.org/jira/browse/CALCITE-3539
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.21.0
            Reporter: Ruben Q L
            Assignee: Ruben Q L
             Fix For: 1.22.0


The issue can be reproduced by adding the following test to 
EnumerablesTest.java:
{code:java}
@Test public void testNestedLoopSemiJoin() {
  assertThat(
    EnumerableDefaults.nestedLoopJoin(DEPTS, EMPS, (d, e) -> d.deptno == 
e.deptno,
          (d, e) -> d.toString(), JoinType.SEMI).toList().toString(),
    equalTo("[Dept(20, Sales)]"));
}
{code}
This test performs a "DEPT semi-join EMP" (i.e. select all departments which 
have at least one employee):
{code:java}
SELECT * FROM DEPT
WHERE EXISTS (SELECT 1 FROM EMP 
    WHERE DEPT.DEPTNO = EMP.DEPTNO)
{code}
This semi-join query must not return duplicates, however out test returns:
{code:java}
Expected: "[Dept(20, Sales)]"
  but: was "[Dept(20, Sales), Dept(20, Sales)]"
{code}



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

Reply via email to