2010YOUY01 commented on code in PR #19609:
URL: https://github.com/apache/datafusion/pull/19609#discussion_r2681652778
##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -746,6 +968,106 @@ fn check_short_circuit<'a>(
ShortCircuitStrategy::None
}
+/// For expressions like `left OP right`, calculate the `PruningOutcome` given
child
+/// expression's range statistics, and operator type.
+///
+/// The supported operators are: >, <, =, >=, <=
+///
+/// Bounds encoding: each bound uses an `Option` to encode a NULL range value;
+/// `None` means the bound is NULL, and `Some` must contain a non-null
`ScalarValue`.
+/// This is due to the existing ScalarValue comparison having unexpected null
behavior:
+/// <https://github.com/apache/datafusion/issues/19579>
+///
+/// Type compatibility: if all bound data types are not equal, return
+/// `PruningOutcome::UnknownOrMixed` as a safe fallback. For different but
+/// compatible types (e.g., lhs is Int32, rhs is Int64), the type coercion
+/// optimizer rule should already handle them before evaluating pruning.
+///
+/// # Errors
+/// Returns Internal Error if unsupported operator is provided.
+fn compare_ranges(
Review Comment:
I have checked, it has reached 100% test line coverage by
```
cargo +nightly llvm-cov \
--package datafusion-physical-expr \
--test pruning \
--all-features \
--html \
--open \
-- --nocapture
```
Though it's covered by higher-level pruning API tests, not the UT directly
on it. The benefit is the test coverage won't be lost when we change the
implementation to a vectorized `compare_ranges_vectorized`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]