Re: How to apply rules to subqueries in calcite?
There are two ways to deal with sub-queries. The old way is to expand them during sql-to-rel conversion (see SqlToRelConverter.Config.isExpand()). The new way is to leave them in during sql-to-rel conversion, in which case you get RexSubQuery expressions in the RelNode tree, and deal with them using SubQueryRemoveRule.
The new approach is better. There are some subtle bugs (especially involving correlated queries) that we have not fixed if you use the old way.
> On May 3, 2018, at 4:28 AM, aishwaryaanns@xxxxxxxxx wrote:
> For queries having 'in' (sub query), I am not getting optimized plans for sub query. How to apply rules to sub queries to get optimized plans on a whole?
> Thanks in advance