emilk commented on code in PR #24322:
URL: https://github.com/apache/datafusion/pull/24322#discussion_r3775045023
##########
datafusion/core/tests/user_defined/user_defined_scalar_functions.rs:
##########
@@ -1877,7 +1872,7 @@ impl ExtensionType for MyUserExtensionType {
&self,
data_type: &DataType,
) -> std::result::Result<(), ArrowError> {
- if let DataType::Utf8 = data_type {
+ if matches!(data_type, DataType::Utf8) {
Review Comment:
Done, now `*data_type == DataType::Utf8`.
-- Claude
##########
datafusion/pruning/src/pruning_predicate.rs:
##########
@@ -795,14 +795,12 @@ impl BoolVecBuilder {
fn is_always_true(expr: &Arc<dyn PhysicalExpr>) -> bool {
expr.downcast_ref::<phys_expr::Literal>()
- .map(|l| matches!(l.value(), ScalarValue::Boolean(Some(true))))
- .unwrap_or_default()
+ .is_some_and(|l| matches!(l.value(), ScalarValue::Boolean(Some(true))))
Review Comment:
Done, both `is_always_true` and `is_always_false` now use `*l.value() ==
ScalarValue::Boolean(..)`.
-- Claude
##########
datafusion/spark/src/function/string/length.rs:
##########
@@ -154,10 +154,10 @@ where
} else {
let values: Vec<_> = (0..array.len())
.map(|i| {
- // Safety: we are iterating with array.len() so the index
is always valid
if array.is_null(i) {
i32::default()
} else {
+ // SAFETY: we are iterating with array.len() so the
index is always valid
Review Comment:
Reverted in 8539c9690 — the lint is out of the PR too.
-- Claude
##########
datafusion/expr/src/predicate_bounds.rs:
##########
@@ -166,7 +166,7 @@ impl PredicateBoundsEvaluator<'_> {
}
// If `expr` is not nullable, we can be certain `expr` is not null
- if let Ok(false) = expr.nullable(self.input_schema) {
+ if matches!(expr.nullable(self.input_schema), Ok(false)) {
Review Comment:
Done, but as `.ok() == Some(false)`: `DataFusionError` does not implement
`PartialEq`, so `== Ok(false)` does not compile.
-- Claude
--
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]