planner: prove null-reject for deferred expressions (#67789)#68850
planner: prove null-reject for deferred expressions (#67789)#68850ti-chi-bot wants to merge 1 commit into
Conversation
|
This cherry pick PR is for a release branch and has not yet been approved by triage owners. To merge this cherry pick:
DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@winoros This PR has conflicts, I have hold it. |
|
@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughIsNullRejected's API was simplified by removing the skipPlanCacheCheck parameter; implementation comments were clarified. All planner call sites (logical join, aggregation, projection, funcdep extraction) and a test were updated to the new 3-argument signature. ChangesIsNullRejected API signature simplification
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
pkg/planner/util/null_misc_test.go (2)
194-228:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winUnresolved merge conflict blocks compilation.
The file contains unresolved merge conflict markers that will cause a syntax error. The conflict is between the release-8.5 branch (which includes week/yearweek nullable-mode test expressions from a separate PR) and the cherry-picked commit.
To resolve: decide whether to keep the week/yearweek test expressions (from HEAD) or remove them (from the cherry-picked commit), then remove all conflict markers.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/planner/util/null_misc_test.go` around lines 194 - 228, The file has unresolved merge conflict markers around test variables weekWithNullableMode, yearWeekWithNullableMode, weekWithNullableDateAndOuterMode, and yearWeekWithNullableDateAndOuterMode; remove the conflict markers and either keep the block that constructs those newNullRejectFunc tests (using newNullRejectStringConst("2024-01-08"), innerDate, outerC as in HEAD) or drop that block to match the cherry-picked commit, ensuring no <<<<<<<, =======, >>>>>>> remain and the file compiles; verify newNullRejectFunc/newNullRejectStringConst, innerDate and outerC references are consistent after resolution.
391-441:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winSecond unresolved merge conflict in test cases array.
This conflict corresponds to the expression-setup conflict above. Ensure both conflicts are resolved consistently—if the week/yearweek expressions are retained, these test cases must also be kept; if removed, these entries must be deleted along with the conflict markers.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/planner/util/null_misc_test.go` around lines 391 - 441, Resolve the merge conflict by removing Git conflict markers and making the test cases array consistent with the resolved expression definitions: either keep the four test entries (names "week_nullable_mode_uses_default_mode_zero", "yearweek_nullable_mode_uses_default_mode_zero", "week_nullable_date_rejects_null_even_with_outer_mode", "yearweek_nullable_date_rejects_null_even_with_outer_mode") and ensure the referenced symbols weekWithNullableMode, yearWeekWithNullableMode, weekWithNullableDateAndOuterMode, yearWeekWithNullableDateAndOuterMode and the helper newNullRejectFunc/exprCtx are present, or delete those four entries entirely if the corresponding week/yearweek expressions were removed; in all cases remove the <<<<<<</=======/>>>>>>> markers and keep the file compile/test-clean.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/planner/util/funcdep_misc.go`:
- Around line 45-49: Remove the unresolved merge conflict markers (<<<<<<<,
=======, >>>>>>>) and keep the updated call to IsNullRejected with three
arguments: replace the conflicted block so it calls IsNullRejected(p.SCtx(),
p.Schema(), condition, true); ensure no leftover conflict markers remain and
that the surrounding code compiles with the IsNullRejected function signature.
---
Outside diff comments:
In `@pkg/planner/util/null_misc_test.go`:
- Around line 194-228: The file has unresolved merge conflict markers around
test variables weekWithNullableMode, yearWeekWithNullableMode,
weekWithNullableDateAndOuterMode, and yearWeekWithNullableDateAndOuterMode;
remove the conflict markers and either keep the block that constructs those
newNullRejectFunc tests (using newNullRejectStringConst("2024-01-08"),
innerDate, outerC as in HEAD) or drop that block to match the cherry-picked
commit, ensuring no <<<<<<<, =======, >>>>>>> remain and the file compiles;
verify newNullRejectFunc/newNullRejectStringConst, innerDate and outerC
references are consistent after resolution.
- Around line 391-441: Resolve the merge conflict by removing Git conflict
markers and making the test cases array consistent with the resolved expression
definitions: either keep the four test entries (names
"week_nullable_mode_uses_default_mode_zero",
"yearweek_nullable_mode_uses_default_mode_zero",
"week_nullable_date_rejects_null_even_with_outer_mode",
"yearweek_nullable_date_rejects_null_even_with_outer_mode") and ensure the
referenced symbols weekWithNullableMode, yearWeekWithNullableMode,
weekWithNullableDateAndOuterMode, yearWeekWithNullableDateAndOuterMode and the
helper newNullRejectFunc/exprCtx are present, or delete those four entries
entirely if the corresponding week/yearweek expressions were removed; in all
cases remove the <<<<<<</=======/>>>>>>> markers and keep the file
compile/test-clean.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: cc472080-1043-418b-bfcf-90201f387ee3
📒 Files selected for processing (6)
pkg/planner/core/operator/logicalop/logical_aggregation.gopkg/planner/core/operator/logicalop/logical_join.gopkg/planner/core/operator/logicalop/logical_projection.gopkg/planner/util/funcdep_misc.gopkg/planner/util/null_misc.gopkg/planner/util/null_misc_test.go
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
5e46cee to
d554da6
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/unhold |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-8.5 #68850 +/- ##
================================================
Coverage ? 55.1038%
================================================
Files ? 1824
Lines ? 656334
Branches ? 0
================================================
Hits ? 361665
Misses ? 267761
Partials ? 26908
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest |
This is an automated cherry-pick of #67789
What problem does this PR solve?
Issue Number: close #67788, close #65583
Problem Summary:
Null-reject proof skipped
Constantexpressions withDeferredExprto avoid treating plan-cache-sensitive runtime values as static constants. That was conservative, but it also missed safe symbolic proof opportunities and left a now-obsolete plan-cache compatibility parameter onplanner/util.IsNullRejected.What changed and how does it work?
This PR lets null-reject proof inspect
DeferredExprsymbolically without evaluating or nullify-folding its runtime value.allowNullifiedFoldmode toproveNullRejected. Normal proof still uses the nullify-then-fold bridge. When descending intoConstant.DeferredExpr, the proof keeps using structural null-reject rules but disables nullified folding.ParamMarkerandDeferredExprout of static constant folding candidates.skipPlanCacheCheckargument fromIsNullRejectedand update its callers.Check List
Tests
Unit tests:
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Summary by CodeRabbit
Refactor
Tests