Repository navigation
docs(optimizer): add generated optimizer rules reference - #21824
Conversation
|
cc @comphead |
|
Hi @kumarUjjawal , i don't know if i am write but as per @comphead's comment
i think what we really need is an end to end doc that describe all 21 optimizer both type , could you look into this ? |
|
Thanks for the feedback @Adez017 The missing doc here is a reference page for the built-in rules, not another end-to-end optimizer guide. We already have docs for how the optimizer works and how to extend it. This PR adds the missing reference: which built-in rules exist and what each one does, and links it from the existing optimizer guide. |
Thanks for clarification @kumarUjjawal |
|
|
||
| The plan contains limits that can be proven redundant or can collapse to simpler forms. | ||
|
|
||
| (logical-rule-14)= |
There was a problem hiding this comment.
what are those logical rule entries?
There was a problem hiding this comment.
Those are just MyST/Sphinx labels for the intra-page links. I had raw HTML anchors there first, but that caused docs warnings and the docs build failed in CI so I switched to this as it was already being used in other docs.
comphead
left a comment
There was a problem hiding this comment.
Thanks @kumarUjjawal, great PR
Tbh I'm not sure if we need a separate doc generator for optimization rules, unlike to builtin functions we dont have that many rules and new rules introduced not very frequently.
Frankly speaking, I was thinking just feed optimizer crates to LLM and generate the docs, review and improve, WDYT?
|
Thanks @comphead I agree, I think a fully hand written or as you said LLM generated page could also work, but in that case I would still want some kind of sync check to stop it drifting. Given that, a small generator felt like the safer option. The reason I leaned toward generation here is that this page is meant to be reference docs, so the rule names, order, stages, and repeated physical passes should stay aligned with the actual default pipelines and with what users see in EXPLAIN VERBOSE. |
|
I can rework this if doc generator is too much for this PR. |
making documentation in sync with optimizer rules makes a lot of sense, there is no guard right now. Reg to generator, currently we have automated generation based proc macros for built in function and having another generator would be confusing IMO, however you trigger an awesome idea of having unified documentation framework that works for the entire core. Having that we would cover all aspects of core documentation + automatic md generation |
I see we do not want to end up with a bunch of one-off doc generators.
I think we should work toward this rather than having generator for each peices like this PR. I will remove the optimizer-specific generator, maybe you can start the discussion around the shared docs generation framework. |
We probably too overcomplicate things: generators are the last haven, for builtin functions it was made because the std tool like rustdoc was not enough. I feel we need to stick to rustdoc as much as possible, and this particular case should fit IMO. For example refer to |
Fair point, rustdoc with some sync guard would be better option. Thanks! |
comphead
left a comment
There was a problem hiding this comment.
Thanks @kumarUjjawal for the contribution, it is LGTM
|
Here is a proposed followon to consolidate these docs into the main docs: #26899 |
…apache#26899) ## Which issue does this PR close? - Follow on to apache#21824 ## Rationale for this change `datafusion/core/src/optimizer_rule_reference.md` documents the optimizer and rules It was added in this PR from @kumarUjjawal - apache#21824 While it is spliced into the `datafusion` crate docs via `include_str!`, keeping the refernece a separate markdown file means 1. it lives far from the rule lists it describes, so can drifts (for example, the `eliminate_join` summary no longer matched the rule's behavior) 2. needed a dedicated test to keep the order in sync. ## What changes are included in this PR? This PR moves the content next to the code so the rule list and its documentation ## What is the testing strategy for this PR? CI ## Are there any user-facing changes? No API changes. The rule reference moves from the `datafusion` crate root docs to the three constructor docs. --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
Which issue does this PR close?
Rationale for this change
There is no reference page that lists the built-in analyzer, logical optimizer, and physical optimizer rules. This PR adds that missing reference.
What changes are included in this PR?
eliminate_joindescription so it matches the actual rule behavior.Are these changes tested?
Yes
Are there any user-facing changes?
No Public API Change