crm26 opened a new pull request, #21542: URL: https://github.com/apache/datafusion/pull/21542
## Summary - Adds `cosine_distance(array1, array2)` / `list_cosine_distance` — computes cosine distance (1 - cosine similarity) between two numeric arrays - Introduces shared `vector_math.rs` primitives (`dot_product_f64`, `magnitude_f64`, `convert_to_f64_array`) for reuse by follow-on vector functions - Returns NULL for zero-magnitude vectors; errors on mismatched lengths - Supports List, LargeList, and FixedSizeList with any numeric element type Part of #21536 — first in a series of split PRs (replacing #21371). ## Test plan - [x] Unit tests: identical, orthogonal, opposite, 45-degree, zero-magnitude, mismatched-length, NULL, multi-row - [x] sqllogictest: `cosine_distance.slt` covering all edge cases including empty arrays, LargeList, integer coercion, alias, return type - [x] Full slt suite (426/426 pass) - [x] `cargo clippy`, `cargo fmt`, `taplo`, `prettier`, `cargo machete` — all clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
