jatin510 commented on code in PR #14236: URL: https://github.com/apache/datafusion/pull/14236#discussion_r1927082321
########## datafusion/functions-nested/src/repeat.rs: ########## @@ -124,19 +125,47 @@ impl ScalarUDFImpl for ArrayRepeat { &self.aliases } + fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>> { + if arg_types.len() != 2 { + return exec_err!("array_repeat expects two arguments"); + } + + let element_type = &arg_types[0]; + let first = element_type.clone(); + + let count_type = &arg_types[1]; + + // Coerce the second argument to Int64/UInt64 if it's a numeric type + let second = match count_type { + DataType::Int8 | DataType::Int16 | DataType::Int32 | DataType::Int64 => { Review Comment: @korowa @alamb converting negative numbers to UInt was giving: `arrow error, can't cast negative number to Uint`. So, converted the Int values to `Int64` . Then using `array_repeat` inner function to convert `Int64` to `UInt64` type -- 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