[
https://issues.apache.org/jira/browse/CALCITE-3539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16983270#comment-16983270
]
Ruben Q L commented on CALCITE-3539:
------------------------------------
Probably the issue was originated by the "big Join refactoring" (CALCITE-2969),
which added SEMI / ANTI as "normal" join types; but
EnumerableDefaults#nestedLoopJoin was not adapted accordingly to support SEMI.
> 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
> Priority: Blocker
> 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
> them:
> {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)