edubraqd opened a new issue, #24937: URL: https://github.com/apache/datafusion/issues/24937
### Describe the bug `ScalarValue::partial_cmp` for list values (`partial_cmp_list` in `datafusion/common/src/scalar/mod.rs`) compares the elements with the `arrow::compute::kernels::cmp::lt` / `eq` kernels. Those kernels reject nested element types, so the comparison returns `None` and callers report an internal error. `min` / `max` are the most visible callers, but anything that orders list scalars is affected. ### To Reproduce ```sql SELECT min(column1), max(column1) FROM VALUES ([[1, 2]]), ([[1, 3]]); ``` ```text Internal error: Uncomparable values: List([[1, 2]]), List([[1, 3]]). This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues ``` Same for a list of structs: `SELECT min(column1) FROM VALUES ([struct(1, 'a')]), ([struct(2, 'b')]);` Comparing the same values with the binary operators (`[[1, 2]] < [[1, 3]]`) works, since that path uses the array comparison kernels directly. ### Expected behavior Lists of nested values compare lexicographically like lists of primitives do, so `min` returns `[[1, 2]]` and `max` returns `[[1, 3]]`. ### Additional context Found while running a corpus of aggregate queries over nested types against `datafusion-cli`. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
