jorgecarleitao commented on a change in pull request #9243:
URL: https://github.com/apache/arrow/pull/9243#discussion_r562389680
##########
File path: rust/datafusion/src/physical_plan/type_coercion.rs
##########
@@ -69,13 +69,42 @@ pub fn data_types(
signature: &Signature,
) -> Result<Vec<DataType>> {
let valid_types = match signature {
- Signature::Variadic(valid_types) => valid_types
+ Signature::Any(number) => {
+ if current_types.len() != *number {
+ return Err(DataFusionError::Plan(format!(
+ "The function expected {} arguments but received {}",
+ number,
+ current_types.len()
+ )));
+ }
+ vec![(0..*number).map(|i| current_types[i].clone()).collect()]
+ }
+ Signature::Exact(valid_types) => vec![valid_types.clone()],
+ Signature::Uniform(valid_types) => {
+ let valid_signature = valid_types
+ .iter()
+ .filter(|x| x.len() == current_types.len())
+ .collect::<Vec<_>>();
+ if valid_signature.len() != 1 {
+ return Err(DataFusionError::Plan(format!(
+ "The function expected {} arguments but received {}",
+ valid_types
+ .iter()
+ .map(|x| x.len().to_string())
+ .collect::<Vec<_>>()
+ .join(" or "),
+ current_types.len()
+ )));
+ }
+ cartesian_product(valid_signature.first().unwrap())
Review comment:
I suggest that we PR this separately with a single function that
requires this type of signature, as we need to get this requires much more care
than the other parts of this PR as it affects all future functions that use it.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]