Omega359 commented on code in PR #11942: URL: https://github.com/apache/datafusion/pull/11942#discussion_r1715698875
########## datafusion/functions/src/unicode/rpad.rs: ########## @@ -76,97 +84,168 @@ impl ScalarUDFImpl for RPadFunc { } fn invoke(&self, args: &[ColumnarValue]) -> Result<ColumnarValue> { - match args[0].data_type() { - DataType::Utf8 => make_scalar_function(rpad::<i32>, vec![])(args), - DataType::LargeUtf8 => make_scalar_function(rpad::<i64>, vec![])(args), - other => exec_err!("Unsupported data type {other:?} for function rpad"), + match args.len() { + 2 => match args[0].data_type() { + DataType::Utf8 | DataType::Utf8View => { + make_scalar_function(rpad::<i32, i32>, vec![])(args) + } + DataType::LargeUtf8 => { + make_scalar_function(rpad::<i64, i64>, vec![])(args) + } + other => exec_err!("Unsupported data type {other:?} for function rpad"), + }, + 3 => match (args[0].data_type(), args[2].data_type()) { + ( + DataType::Utf8 | DataType::Utf8View, + DataType::Utf8 | DataType::Utf8View, Review Comment: This line looks to be a duplicate. Correction, my mistake, ignore. ########## datafusion/functions/src/unicode/rpad.rs: ########## @@ -76,97 +84,168 @@ impl ScalarUDFImpl for RPadFunc { } fn invoke(&self, args: &[ColumnarValue]) -> Result<ColumnarValue> { - match args[0].data_type() { - DataType::Utf8 => make_scalar_function(rpad::<i32>, vec![])(args), - DataType::LargeUtf8 => make_scalar_function(rpad::<i64>, vec![])(args), - other => exec_err!("Unsupported data type {other:?} for function rpad"), + match args.len() { + 2 => match args[0].data_type() { + DataType::Utf8 | DataType::Utf8View => { + make_scalar_function(rpad::<i32, i32>, vec![])(args) + } + DataType::LargeUtf8 => { + make_scalar_function(rpad::<i64, i64>, vec![])(args) + } + other => exec_err!("Unsupported data type {other:?} for function rpad"), + }, + 3 => match (args[0].data_type(), args[2].data_type()) { + ( + DataType::Utf8 | DataType::Utf8View, + DataType::Utf8 | DataType::Utf8View, Review Comment: This line looks to be a duplicate. Correction, my mistake, ignore. -- 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