2010YOUY01 commented on code in PR #8268:
URL: https://github.com/apache/arrow-datafusion/pull/8268#discussion_r1398720466


##########
datafusion/expr/src/built_in_function.rs:
##########
@@ -571,6 +574,7 @@ impl BuiltinScalarFunction {
             BuiltinScalarFunction::ArrayDims => {
                 Ok(List(Arc::new(Field::new("item", UInt64, true))))
             }
+            BuiltinScalarFunction::ArrayDistinct => 
Ok(input_expr_types[0].clone()),

Review Comment:
   Is it possible to add additional input check here like
   ```rust
   match input_expr_types[0] {
       List(_) => Ok(input_expr_types[0].clone()),
       _ => return plan_err!("...")
   }
   ```
   To make this query an error instead of panic
   ```
   ❯ select array_distinct(1);
   Optimizer rule 'simplify_expressions' failed
   caused by
   Internal error: could not cast value to 
arrow_array::array::list_array::GenericListArray<i32>.
   This was likely caused by a bug in DataFusion's code and we would welcome 
that you file an bug report in our issue tracker
   ```



##########
datafusion/expr/src/built_in_function.rs:
##########
@@ -571,6 +574,7 @@ impl BuiltinScalarFunction {
             BuiltinScalarFunction::ArrayDims => {
                 Ok(List(Arc::new(Field::new("item", UInt64, true))))
             }
+            BuiltinScalarFunction::ArrayDistinct => 
Ok(input_expr_types[0].clone()),

Review Comment:
   Is it possible to add additional input check here like
   ```rust
   match input_expr_types[0] {
       List(_) => Ok(input_expr_types[0].clone()),
       _ => return plan_err!("...")
   }
   ```
   To make this query an error instead of panic
   ```
   ❯ select array_distinct(1);
   Optimizer rule 'simplify_expressions' failed
   caused by
   Internal error: could not cast value to 
arrow_array::array::list_array::GenericListArray<i32>.
   This was likely caused by a bug in DataFusion's code and we would welcome 
that you file an bug report in our issue tracker
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to