[
https://issues.apache.org/jira/browse/FLINK-4565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15725123#comment-15725123
]
ASF GitHub Bot commented on FLINK-4565:
---------------------------------------
Github user NickolayVasilishin commented on the issue:
https://github.com/apache/flink/pull/2870
Also the last commit represents possible way of implementing subquery IN
operator.
On one hand, it's really simple implementation, all work delegates to
already proprely working components, generated logical plan looks practically
identical to one generated in similar SQL query.
On the other hand, it maybe looks ugly, because it's placed in one of top
layers of API. Also we can't use `validateInputs` method there because field on
the right side isn't resolved yet. But I think, there are ways to validate
inputs.
I've tried to solve this problem in more convinient way. It looks like
implementation of IN for literals, but I've faced problems:
- generating `RexNode` for IN qubquery. I've tried to use all possible
variants, but logical plan for subquery was incorrect (had duplicated IN
expression, for example). It's solvable, but needs changes in `Calcite`, I
think.
- implementation of `SubQueryVisitor` and `RelShuttle`. I didn't find ways
to reuse existing code in this case. Also there isn't any existing examples
which I was able to use as template.
- it's not clear for me, how to use results of subquery in the operator
(especially relationship between generated code).
- generated logical plan differs from one generated in SQL query.
Also I thought about substitution of plan with inner join instead of plan
with IN operator somewhere in code. I assumed that the same thing takes place
in SQL API, but Calcite translates `IN` to `INNER JOIN` at the beginning.
That's why I decided to implement subqueries this way.
> 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
> Assignee: Nikolay Vasilishin
>
> 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)