jayzhan211 commented on code in PR #14532: URL: https://github.com/apache/datafusion/pull/14532#discussion_r1951778634
########## datafusion/expr-common/src/signature.rs: ########## @@ -286,6 +258,72 @@ impl Display for ArrayFunctionSignature { } } +/// A wrapper around a vec of [`ArrayFunctionArgument`], to ensure that the vec has at least one +/// array element. +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Hash)] +pub struct ArrayFunctionArguments { + /// A full list of the arguments accepted by a function. + arguments: Vec<ArrayFunctionArgument>, +} + +impl ArrayFunctionArguments { + /// Returns an error if there are no [`ArrayFunctionArgument::Array`] arguments. + pub fn new(arguments: Vec<ArrayFunctionArgument>) -> Result<Self, &'static str> { + if !arguments + .iter() + .any(|arg| *arg == ArrayFunctionArgument::Array) Review Comment: instead of checking here, I think we can verify the validity in `get_valid_types`, so the definition of signature can be simplified. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org