zhengruifeng opened a new pull request, #58816: URL: https://github.com/apache/spark/pull/58816
### What changes were proposed in this pull request? This PR moves `VectorDotProduct` evaluation into static `MLExpressionUtils` helpers and adds a code-generation fast path for a foldable vector operand. When either vector is foldable and non-null, code generation evaluates it once and caches its size, indices, and values as primitive data. The generated expression evaluates only the dynamic operand and uses specialized dense/sparse dot-product helpers. The existing row/row helper remains the fallback when neither operand can be cached. The expression tests cover literal and non-literal foldable vectors, both operand positions, and all dense/sparse combinations. ### Why are the changes needed? The `vector_dot_product(column, Vector)` path represents the constant vector as a foldable struct. Previously, every input row decoded both vector structs and accessed both sets of values through `ArrayData`. Caching the foldable side removes its repeated struct decoding and enables primitive array access in the inner dot-product loops. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? - `build/sbt 'catalyst/testOnly org.apache.spark.sql.catalyst.expressions.ml.VectorDotProductSuite'` - `build/sbt 'mllib/testOnly org.apache.spark.ml.FunctionsSuite -- -z "test vector_dot_product"'` ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Codex (GPT-5) -- 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]
