[
https://issues.apache.org/jira/browse/CALCITE-3539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ruben Q L resolved CALCITE-3539.
--------------------------------
Resolution: Fixed
> 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
> Labels: pull-request-available
> Fix For: 1.22.0
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> 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 the test returns
> them (it returns "Sales" two times because it has two employees, but this is
> wrong, it should be returned just once):
> {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)