Repository navigation
Conversation
The rule-application debug log in IterativeOptimizer passed empty strings for the before/after plan slots, so enabling DEBUG produced entries with a rule name and two blank sections. Render the node being rewritten and the transformed plan instead, using the existing PlanGraphJsonPrinter. To make that work for optimizer-internal plans, treat GroupReference as a leaf in the printer: it throws from getChildren(), which previously made the whole render fail. Rendering is best-effort and debug-gated; a rendering failure falls back to the node's toString so a debug log can never fail a query. Rule timing is now taken before logging, so enabling DEBUG no longer inflates the recorded rule time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
IterativeOptimizerlogs every rule application at DEBUG level, but the before/after plan slots were filled with empty strings:The message template is
"Rule: {}\nBefore:\n{}\nAfter:\n{}", so enablingDEBUGfor this logger produced a rule name followed by two blank sections — the log existed but carried no diagnostic value. This is a leftover from the initial table-model port; the placeholders were never filled in (verified viagit log: they were already empty before the i18n conversion of this literal).Changes
IterativeOptimizer: render the node being rewritten and the transformed plan with the existingPlanGraphJsonPrinter, and pass them into the log.PlanGraphJsonPrinter: treatGroupReferenceas a leaf. Optimizer-internal nodes haveGroupReferencechildren, andGroupReference.getChildren()throwsUnsupportedOperationException, which made both plan printers fail on such plans. This is a no-op for EXPLAIN, where group references never appear.Rendering is best-effort and debug-gated: if rendering throws, the log falls back to the node's
toString, so a debug log can never fail a query.Example output
With
DEBUGenabled fororg.apache.iotdb.db.queryengine.plan.relational.planner.iterative.IterativeOptimizer:Test plan
PlanGraphJsonPrinterTest— addedtestGroupReferenceIsRenderedAsLeaf, which renders a plan whose child is aGroupReferenceand asserts it is emitted as a leaf and that rendering does not throw.PlanGraphJsonPrinterTest,PlanGraphPrinterTestandTableModelPlannerTest: 21 tests, 0 failures.🤖 Generated with Claude Code