rafafrdz commented on code in PR #17485: URL: https://github.com/apache/datafusion/pull/17485#discussion_r2340230080
########## datafusion/spark/src/function/url/parse_url.rs: ########## @@ -47,23 +46,7 @@ impl Default for ParseUrl { impl ParseUrl { pub fn new() -> Self { Self { - signature: Signature::one_of( - vec![ - TypeSignature::Uniform( - 1, - vec![DataType::Utf8View, DataType::Utf8, DataType::LargeUtf8], - ), - TypeSignature::Uniform( - 2, - vec![DataType::Utf8View, DataType::Utf8, DataType::LargeUtf8], - ), - TypeSignature::Uniform( - 3, - vec![DataType::Utf8View, DataType::Utf8, DataType::LargeUtf8], - ), - ], - Volatility::Immutable, - ), + signature: Signature::user_defined(Volatility::Immutable), Review Comment: Sorry, I don’t quite follow… Why should dictionary types be used as arguments for parse_url or try_parse_url? As far as I understand, the spec only expects string types [parse_url doc ref](https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.parse_url.html) ########## datafusion/spark/src/function/url/parse_url.rs: ########## @@ -152,22 +135,39 @@ impl ScalarUDFImpl for ParseUrl { arg_types.len() ); } + // The return type should match the largest size datatype match arg_types.len() { - 2 | 3 => { + 2 | 3 if arg_types.iter().all(is_string_type) => { if arg_types .iter() .any(|arg| matches!(arg, DataType::LargeUtf8)) { Ok(DataType::LargeUtf8) - } else if arg_types - .iter() - .any(|arg| matches!(arg, DataType::Utf8View)) - { - Ok(DataType::Utf8View) } else { Ok(DataType::Utf8) } } + 2 | 3 => plan_err!( + "`{}` expects STRING arguments, got {:?}", + &self.name(), + arg_types + ), + _ => plan_err!( + "`{}` expects 2 or 3 arguments, got {}", + &self.name(), + arg_types.len() + ), Review Comment: done! 😄 -- 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