| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…Stage `RichExplainerConsole` had no `visit_physical_layer_schema_creation_stage`, so explaining a plan that includes `PhysicalLayerSchemaCreationStage` logged `ERROR - Unexpected stage: PhysicalLayerSchemaCreationStage` and silently omitted the stage from the explained plan. Add the missing visit method. It mirrors the schema derivation in `SnapshotEvaluator.create_physical_schemas` (non-symbolic models only, table name resolved through the deployability index) and lists the distinct physical schemas that will be created. `test_plan_explain` now asserts that no stage is reported as unexpected, which covers this stage and guards against the same omission for future ones. Fixes SQLMesh#5619 Signed-off-by: nkwork9999 <143652584+nkwork9999@users.noreply.github.com>
|
@nkwork9999 Thanks for this pr! No blocker, but do you think it's worth asserting the explained output includes the schema-creation node (e.g. “Create physical schemas…” / sqlmesh__sushi), not only that “Unexpected stage” is absent. Today’s guard catches missing handlers but not wrong/empty rendering. |
Sorry, something went wrong.
|
@nkwork9999 Just wanted to follow up on this! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #5619
Problem
RichExplainerConsole has no visit_physical_layer_schema_creation_stage, so when a plan contains PhysicalLayerSchemaCreationStage, explain() falls into the hasattr guard at explainer.py:134:
The stage is then silently dropped from the explained plan, even though PlanEvaluator handles it in evaluator.py:209.
Change
Add the missing visit method. It mirrors the schema derivation in SnapshotEvaluator.create_physical_schemas / _create_schemas — non-symbolic models only, table name resolved through the stage's deployability index, deduplicated by (db, catalog) — and lists the distinct physical schemas that will be created. Returns None when there is nothing to create, consistent with the other Optional[Tree] visit methods.
Placed directly before visit_physical_layer_update_stage to match the stage ordering produced in stages.py.
Output on examples/sushi:
Tests
test_plan_explain previously only asserted that explaining does not raise, which is why this went unnoticed. It now asserts that no stage is reported as unexpected, which covers this stage and guards against the same omission for stages added later.
Verified the test fails on main with the fix reverted:
tests/core/test_plan.py, tests/core/test_plan_stages.py, tests/core/test_context.py and tests/core/integration/test_plan_options.py pass (207 tests), as do ruff format, ruff check and mypy on the changed files.