Skip to content

[SQL] Compiler option to convert CTEs into local views #6827

Description

@mihaibudiu

Some complex queries containing (non-recursive) CTEs cannot be decorrelated by the current Calcite decorrelator. Sometimes decomposing such queries into a sequence of LOCAL VIEWs, one for each CTE, makes the query compilable. Implement a compiler analysis which performs this rewrite.

This will have to be performed on the SqlNode layer, after validation, since the Rel layer does not have a notion of CTE.

This could be exposed as a compiler option for manual use.

It should also be an automatic strategy to try recompiling a query if the decorrelator fails.

Metadata

Metadata

Assignees

Labels

SQL compilerRelated to the SQL compiler

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions