comphead commented on code in PR #8726:
URL: https://github.com/apache/arrow-datafusion/pull/8726#discussion_r1441940444
##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -2110,16 +2110,34 @@ pub fn cardinality(args: &[ArrayRef]) ->
Result<ArrayRef> {
return exec_err!("cardinality expects one argument");
}
- let list_array = as_list_array(&args[0])?.clone();
+ match &args[0].data_type() {
+ DataType::List(_) => {
+ let list_array = as_list_array(&args[0])?;
+ generic_list_cardinality::<i32>(list_array)
+ }
+ DataType::LargeList(_) => {
+ let list_array = as_large_list_array(&args[0])?;
+ generic_list_cardinality::<i64>(list_array)
+ }
+ _ => {
Review Comment:
```suggestion
other => {
exec_err!(
"cardinality does not support type '{:?}'",
other
)
}
```
--
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]