joroKr21 commented on code in PR #15149:
URL: https://github.com/apache/datafusion/pull/15149#discussion_r1993818465


##########
datafusion/expr-common/src/signature.rs:
##########
@@ -865,6 +867,39 @@ impl Signature {
             volatility,
         }
     }
+
+    /// Specialized Signature for ArrayPrepend and similar functions
+    pub fn element_and_array(volatility: Volatility) -> Self {
+        Signature {
+            type_signature: TypeSignature::ArraySignature(
+                ArrayFunctionSignature::Array {
+                    arguments: vec![
+                        ArrayFunctionArgument::Element,
+                        ArrayFunctionArgument::Array,
+                    ],
+                    array_coercion: Some(ListCoercion::FixedSizedListToList),

Review Comment:
   From a type signature PoV yes, it's possible to infer that the return type 
should also be a fixed-size list with size `n + 1` but the implementation 
itself is not able to handle it:
   ```rust
   pub(crate) fn array_append_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
       let [array, _] = take_function_args("array_append", args)?;
   
       match array.data_type() {
           DataType::LargeList(_) => general_append_and_prepend::<i64>(args, 
true),
           _ => general_append_and_prepend::<i32>(args, true),
       }
   }
   ```
   
   It's unclear to me how an implementation for `FixedSizeList` would look like 
and I would say probably it's out of scope for this PR, it should be separate.



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