Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25684 +/- ##
=======================================
Coverage 82.80% 82.80%
=======================================
Files 1149 1149
Lines 454146 454153 +7
Branches 454146 454153 +7
=======================================
+ Hits 376035 376054 +19
+ Misses 55260 55254 -6
+ Partials 22851 22845 -6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4c747fa to
3fedf2a
Compare
Signed-off-by: 1fanwang <1fannnw@gmail.com>
3fedf2a to
30771ff
Compare
Signed-off-by: 1fanwang <1fannnw@gmail.com>
kosiew
left a comment
There was a problem hiding this comment.
Thanks for the fix! The three-valued bounds handling addresses the reported CASE nullability issue, and the regression coverage looks good. I have one optional suggestion for additional test coverage. This is not a blocker.
| #[case::or(Operator::Or, false, true)] | ||
| #[case::not_and(Operator::And, true, true)] | ||
| #[case::not_or(Operator::Or, true, false)] | ||
| fn test_case_expression_nullability_with_independent_columns( |
There was a problem hiding this comment.
Could we also test mixed AND/OR recursion with CASE WHEN a > 1 AND (b < 3 OR b IS NULL) THEN a ELSE 0 END and its negated form? The first should be non-nullable, while the second is nullable because a = NULL, b = 3 makes the negated condition TRUE. This would cover nested operators beyond the current tests. Not a blocker.
Which issue does this PR close?
Closes #25369
Rationale for this change
Aggregates over a repeated CASE expression can fail during planning when its condition refers to multiple columns. The reported SUM query now returns 1 instead of an internal schema error.
What changes are included in this PR?
Physical CASE nullability uses the existing three-valued bounds for AND, OR and NOT when a condition cannot be evaluated without input rows. The aggregate's schema check stays unchanged.
The non-nullability deduction relies on NULL AND x never being true, for any x, including NULL. OR and NOT must preserve the distinction between false and NULL; the regression tests cover both nullable and non-nullable branches.
What is the testing strategy for this PR?
The SQL regression exercises SUM, COUNT, expanded BETWEEN, NULL inputs, nullable or missing ELSE, and empty input. Parameterized unit tests cover both operand orders. The physical-expression tests also check Boolean-cast failures in literal conditions, both AND/OR operands and NOT, through nullability inference and evaluation.
On macOS arm64 with Rust 1.98.1 and the pinned test data:
Raw logs
Before:
After:
Are there any user-facing changes?
The affected aggregate queries plan and run. There is no public API change.