alamb commented on code in PR #13756:
URL: https://github.com/apache/datafusion/pull/13756#discussion_r1884551111


##########
datafusion/expr/src/type_coercion/functions.rs:
##########
@@ -414,7 +415,18 @@ fn get_valid_types(
             _ => Ok(vec![vec![]]),
         }
     }
+
     fn array(array_type: &DataType) -> Option<DataType> {
+        match array_type {

Review Comment:
   so this says that if the type is a list, keep the type, but if the type is 
large list / fixed size list then take the field type?
   
   Why doesn't it also take the field type for `List` 🤔 ? (Aka it doesn't make 
sense to me that List is treated differently than LargeList and FixedSizeList



##########
datafusion/functions-nested/src/extract.rs:
##########
@@ -993,3 +993,84 @@ where
     let data = mutable.freeze();
     Ok(arrow::array::make_array(data))
 }
+
+#[cfg(test)]
+mod tests {
+    use super::array_element_udf;
+    use arrow_schema::{DataType, Field};
+    use datafusion_common::{Column, DFSchema, ScalarValue};
+    use datafusion_expr::expr::ScalarFunction;
+    use datafusion_expr::{cast, Expr, ExprSchemable};
+    use std::collections::HashMap;
+
+    #[test]
+    fn test_array_element_return_type() {
+        let complex_type = DataType::FixedSizeList(

Review Comment:
   When I change this complex type to `DataType::List` the test passes 🤔 
   
   ```rust
           let complex_type = DataType::List(
               Field::new("some_arbitrary_test_field", DataType::Int32, 
false).into(),
           );
   ```
   
   It also passes when complex_type is a `Struct` 
   
   ```rust
           let complex_type = DataType::Struct(Fields::from(vec![
               Arc::new(Field::new("some_arbitrary_test_field", 
DataType::Int32, false)),
           ]));
   ```
   
   It seems like there is something about FixedSizeList that is causing issues 
to me 
   



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