Hi Liya, Regarding this choice I guess you can have a look in the following discussions [1, 2]. I think there is consensus that we should change this behavior in SqlToRelConverter and generate semi/anti joins directly when this is possible but I think that nobody is working on it at the moment.
Best, Stamatis [1] https://lists.apache.org/thread.html/ra7d7a309592d327a5e912ded7d541c79a3c587fa2daba950cc463762%40%3Cdev.calcite.apache.org%3E [2] https://lists.apache.org/thread.html/f77bf1f946b8c026989163294a2134e485fe7897201c479bbb528c6d%40%3Cdev.calcite.apache.org%3E On Mon, Apr 13, 2020 at 2:11 PM Fan Liya <[email protected]> wrote: > Hi all, > > Given a SQL query with an in subquery: > > select a.name > from dept a > where a.deptno in ( > select b.deptno * 2 > from dept b) > > Calcite translates it to an inner join, but the correct way should be > translating it to a left semi join. > > According to the comments in the code, it seems this behavior is a design > choice. > So can you please help explain the rationale behind this? Do we have a plan > to fix it? > > Best, > Liya Fan >
