martin-g commented on code in PR #21032:
URL: https://github.com/apache/datafusion/pull/21032#discussion_r2958136385
##########
datafusion/expr/src/type_coercion/functions.rs:
##########
@@ -1223,6 +1219,56 @@ mod tests {
Ok(())
}
+ #[test]
+ fn test_one_of_uses_generic_plan_error_instead_of_internal_error() {
+ let current_fields = vec![Arc::new(Field::new("t", DataType::Boolean,
true))];
+ let signature = Signature::one_of(
+ vec![
+ Signature::coercible(
+ vec![Coercion::new_exact(TypeSignatureClass::Decimal)],
+ Volatility::Immutable,
+ )
+ .type_signature
+ .clone(),
+ Signature::coercible(
+ vec![Coercion::new_exact(TypeSignatureClass::Duration)],
+ Volatility::Immutable,
+ )
+ .type_signature
+ .clone(),
Review Comment:
```suggestion
TypeSignature::Coercible(vec![Coercion::new_exact(TypeSignatureClass::Decimal)]),
TypeSignature::Coercible(vec![Coercion::new_exact(TypeSignatureClass::Duration)]),
```
##########
datafusion/expr/src/type_coercion/functions.rs:
##########
@@ -325,24 +325,20 @@ fn get_valid_types_with_udf<F: UDFCoercionExt>(
},
TypeSignature::OneOf(signatures) => {
let mut res = vec![];
- let mut errors = vec![];
for sig in signatures {
- match get_valid_types_with_udf(sig, current_types, func) {
- Ok(valid_types) => {
- res.extend(valid_types);
- }
- Err(e) => {
Review Comment:
This assumes that all errors are mismatch errors.
IMO only planning errors could be ignored.
--
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]