jkosh44 commented on issue #14451: URL: https://github.com/apache/datafusion/issues/14451#issuecomment-2663496088
> @jkosh44 do you have any desired behavior when an argument of incorrect type is passed to the functions? I think an error should be returned. I don't have a strong opinion on what that error should be other than it shouldn't be an internal error. > DuckDB actually treat this as there's no matching function signature I don't think it's _that_ important to match DuckDB errors 100%, but I might be the wrong person to ask. > but we don't have that much information when defining array function signatures. I have two ideas for this. The first is that you can just do type checking inside of `array_sort_inner`, which isn't an ideal solution. The other idea is to extend `ArrayFunctionArgument` to add a new variant: ```Rust #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Hash)] pub enum ArrayFunctionArgument { /// A non-list or list argument. The list dimensions should be one less than the Array's list /// dimensions. Element, /// An Int64 index argument. Index, /// An argument of type List/LargeList/FixedSizeList. All Array arguments must be coercible /// to the same type. Array, /// An arbitrary data type. DataType(DataType), } ``` Then the signature of array_sort could be something like ```Rust signature: Signature::new( TypeSignature::OneOf(vec![ TypeSignature::ArraySignature(ArrayFunctionSignature::Array { arguments: vec![ArrayFunctionArgument::Array], array_coercion: None, }), TypeSignature::ArraySignature(ArrayFunctionSignature::Array { arguments: vec![ ArrayFunctionArgument::Array, ArrayFunctionArgument::DataType(DataType::Utf8), ], array_coercion: None, }), TypeSignature::ArraySignature(ArrayFunctionSignature::Array { arguments: vec![ ArrayFunctionArgument::Array, ArrayFunctionArgument::DataType(DataType::Utf8), ArrayFunctionArgument::DataType(DataType::Utf8), ], array_coercion: None, }), ]), Volatility::Immutable, ), ``` -- 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