| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Codecov Report❌ Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## main #24755 +/- ##
==========================================
- Coverage 81.48% 81.48% -0.01%
==========================================
Files 1122 1122
Lines 404248 404256 +8
Branches 404248 404256 +8
==========================================
+ Hits 329390 329391 +1
- Misses 55547 55550 +3
- Partials 19311 19315 +4 ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Which issue does this PR close?
Rationale for this change
RelationPlanner extensions run before DataFusion's built-in CTE lookup. That ordering is useful, but it leaves a name-based extension unable to tell that a CTE should win over a same-named table. Both plans can be valid, so the mistake is silent: the user asks for the CTE and gets the table instead.
Downstream projects have had to rebuild this context themselves. For example, GlossQL collects CTE names in a pre-pass. Its comment captures the rough edge nicely: because the extension cannot ask DataFusion about the current scope, a CTE declared only inside one subquery may have to be treated as visible everywhere.
DataFusion already has the precise, lexical CTE scope while it plans the query. This PR makes that information available to the extension that needs it.
What changes are included in this PR?
The lookup remains opt-in. A planner with deliberately reserved names can keep intercepting them exactly as it does today.
Are these changes tested?
Yes. The integration tests cover:
I also ran cargo fmt --all, the required all-target/all-feature Clippy command with warnings denied, and the documentation Prettier check.
Are there any user-facing changes?
This adds a small public API for relation-planner authors. It is source-compatible because the trait method has a default implementation. Existing planners keep their current behavior until they opt into the CTE check; planners that do opt in can preserve normal SQL shadowing without re-parsing the statement.