fix: non-breaking detection for redundant cast projections#5851
fix: non-breaking detection for redundant cast projections#5851albertosuman-1k5 wants to merge 5 commits into
Conversation
Signed-off-by: Alberto Suman <alberto.suman@1komma5grad.com>
|
Can we trigger again the workflows? Pretty sure the first run failed because of the issue described in #5852 |
rerunning... |
|
Could you add tests for queries that reference SELECT-list positions from other clauses, such as ordinal It would also be good to add coverage for aliased UDTF projections, since those may not appear as a top-level UDTF expression in the projection list but should still remain conservative. |
Signed-off-by: Alberto Suman <alberto.suman@1komma5grad.com>
|
@mday-io added logic to avoid report as non breaking when order/group by uses positional arguments whose reference is past the introduced expression and to correctly mark aliased UDTF |
Description
Summary
new_col::STRINGabove an existing::STRINGprojection.SqlModel.is_breaking_change()when SQLGlot’s AST diff emits spuriousMove/Updateedits.Context
SQLGlot’s tree diff can cross-match structurally similar cast nodes, especially identical
DataTypeleaves such asSTRING. This can make a purely additive projection change look like a non-Insertdiff, causing SQLMesh to returnNonefromis_breaking_change(). UnderAutoCategorizationMode.FULL, that becomesBREAKING.The new fallback verifies directly that:
SELECTs,Test plan
python -m pytest tests/core/test_snapshot.py -k "categorize_change_sql or categorize_change_seed" -qpython -m pytest cast_breaking_change_demo/test_cast_breaking_change.py -qpython -m pytest tests/core/test_snapshot.py tests/core/test_model.py::test_is_breaking_change tests/core/test_plan.py -qpre-commit run --files sqlmesh/core/model/definition.py tests/core/test_snapshot.py cast_breaking_change_demo/test_cast_breaking_change.pyChecklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCO