korowa commented on code in PR #14236:
URL: https://github.com/apache/datafusion/pull/14236#discussion_r1925801428


##########
datafusion/functions-nested/src/repeat.rs:
##########
@@ -136,7 +137,17 @@ pub fn array_repeat_inner(args: &[ArrayRef]) -> 
Result<ArrayRef> {
     }
 
     let element = &args[0];
-    let count_array = as_int64_array(&args[1])?;
+    let count_array = &args[1];
+
+    let count_array = match count_array.data_type() {
+        DataType::Int8 | DataType::Int16 | DataType::Int32 => {
+            &cast(count_array, &DataType::Int64)?
+        }
+        DataType::Int64 => count_array,
+        _ => return exec_err!("count must be an integer type"),
+    };
+
+    let count_array = as_int64_array(&count_array)?;

Review Comment:
   Maybe `uint` should be used as a target type here? Right now DF panics when 
negative value passed as an argument, which also could be fixed along with type 
casting



##########
datafusion/functions-nested/src/repeat.rs:
##########
@@ -136,7 +137,17 @@ pub fn array_repeat_inner(args: &[ArrayRef]) -> 
Result<ArrayRef> {
     }
 
     let element = &args[0];
-    let count_array = as_int64_array(&args[1])?;
+    let count_array = &args[1];
+
+    let count_array = match count_array.data_type() {
+        DataType::Int8 | DataType::Int16 | DataType::Int32 => {

Review Comment:
   Likely, UInt should also be allowed here



-- 
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

Reply via email to