[ 
https://issues.apache.org/jira/browse/FLINK-4565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15469836#comment-15469836
 ] 

Fabian Hueske commented on FLINK-4565:
--------------------------------------

SQL {{IN}} does not require a special implementation because it can be 
translated into an inner join (as long as the subquery is not correlated with 
the outer query). 
We use Calcite to convert the subquery into a join 
({{RelDecorrelator.decorrelateQuery(relNode)}}) in 
{{org.apache.flink.api.table.BatchTableEnvironment}} line 246.
After the conversion, IN is represented and executed as join.

I think the integration with the Table API can happen in two ways:

1. Generate a RelNode plan with a subquery and let Calcite do the decorrelation 
before the query is optimized (same approach as SQL)
2. Generate a RelNode plan with a Join from the beginning.

I would try to go for the second approach first.


> Support for SQL IN operator
> ---------------------------
>
>                 Key: FLINK-4565
>                 URL: https://issues.apache.org/jira/browse/FLINK-4565
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API & SQL
>            Reporter: Timo Walther
>
> It seems that Flink SQL supports the uncorrelated sub-query IN operator. But 
> it should also be available in the Table API and tested.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to