-
Notifications
You must be signed in to change notification settings - Fork 285
fix: panic when JOIN condition type conversion fails #23191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue https://github.com/matrixorigin/MO-Cloud/issues/6733
What this PR does / why we need it:
When a JOIN operation encounters a type mismatch (e.g., INT = VARCHAR), the type conversion fails during evalJoinCondition(), leaving HashmapBuilder.vecs in a partially initialized state. When Reset() is called during cleanup, it attempts to free nil pointers, causing a panic.
PR Type
Bug fix, Tests
Description
Add nil pointer checks in
Reset()andFree()methods to prevent panicsIntroduce
cleanupPartiallyCreatedVecs()helper to handle partial initialization failuresCall cleanup on errors in
evalJoinCondition()to prevent memory leaksAdd comprehensive regression tests for nil pointer handling in Reset/Free
Add BVT test case for LEFT JOIN with type mismatch error handling
Diagram Walkthrough
File Walkthrough
hashmap_util.go
Add nil pointer safety checks and cleanup helperpkg/sql/colexec/hashmap_util/hashmap_util.go
Reset()method forhb.vecsandhb.UniqueJoinKeysarraysFree()method forhb.UniqueJoinKeysarraycleanupPartiallyCreatedVecs()helper function to safelyfree partially initialized vectors
cleanupPartiallyCreatedVecs()inevalJoinCondition()when errorsoccur during vector evaluation or duplication
hashmap_util_test.go
Add comprehensive nil pointer regression testspkg/sql/colexec/hashmap_util/hashmap_util_test.go
vectorpackageTestResetWithNilPointers()regression test for nil pointerhandling in Reset with needDupVec=true
TestResetWithMixedNilAndValidPointers()test for mixed nil andvalid vectors in Reset
TestFreeWithNilPointers()regression test for nil pointer handlingin Free
TestFreeWithMixedNilAndValidPointers()test for mixed nil andvalid vectors in Free
join.test
Add BVT test for LEFT JOIN type mismatchtest/distributed/cases/join/join.test
join.result
Update test results with type mismatch errortest/distributed/cases/join/join.result