fix(orm): use IS operator for null comparisons in filters#2475
Conversation
`buildLiteralFilter` used `=` for null values, generating `column = NULL` which always evaluates to unknown in SQL. Use `IS NULL` instead, matching the pattern already used by the `equals` operator. Closes #2472 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @ymc9's task —— View job PR Review: fix(orm): use IS operator for null comparisons in filtersReview Checklist
SummaryThis PR fixes a critical SQL correctness issue where Code Quality & Technical Review✅ Core Fix - ExcellentThe change in
✅ Test Coverage - Comprehensive
✅ SQL Correctness - Critical FixThis addresses a fundamental SQL semantic issue: -- Before (incorrect): WHERE column = NULL → always false/unknown
-- After (correct): WHERE column IS NULL → proper null comparisonPerformance & Security✅ Performance - Neutral/Positive
✅ Security - Safe
Edge Cases & Considerations✅ Comprehensive Null HandlingThe new
✅ Backwards Compatibility
Minor Observations
Verdict: Approved ✅This is a high-quality fix that:
The PR successfully resolves issue #2472 and significantly improves the reliability of null filtering operations. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR fixes the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 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)
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 |
Summary
{ fieldName: { not: null } }filter returning empty results instead of non-null recordsbuildLiteralFilter()used SQL=operator for null comparisons (column = NULLis always unknown in SQL), now usesISoperator (column IS NULL){ not: null }on string and numeric fieldsCloses #2472
Test plan
issue-2472.test.tspasses (DateTime and String nullable fields){ not: null }cases for string (name) and numeric (age) fields🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Bug Fixes
not: nullshorthand filter now correctly identifies non-null records across all field types, including strings, numbers, and dates.Tests