zhengruifeng opened a new pull request, #60300:
URL: https://github.com/apache/spark/pull/60300

   ### What changes were proposed in this pull request?
   
   Validate both `VectorDotProduct` operands against the vector SQL schema 
using compatible nullability. Reject nullable elements in `indices` and 
`values`, and accept stricter non-nullable struct fields.
   
   Use typed array literals in the ML constant-vector helper so the dense and 
sparse `vector_dot_product(column, Vector)` overloads retain non-nullable array 
elements.
   
   ### Why are the changes needed?
   
   `StructType.acceptsType` accepts any struct when used directly with 
`ExpectsInputTypes`. Consequently, malformed vector schemas and nullable array 
elements currently pass analysis even though evaluation assumes the vector 
layout and non-null primitive elements.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Incompatible vector structs now fail analysis, including schemas whose 
`indices` or `values` allow null elements. Valid vector columns, null vectors, 
and constant-vector overloads continue to work.
   
   ### How was this patch tested?
   
   Added tests for both operands, nullable array elements, malformed schemas, 
and compatible stricter field nullability.
   
   Compiled the changed sources and suites using the local Scala compiler 
against cached Spark dependencies, then ran ScalaTest directly:
   
   - `VectorDotProductSuite`: all 9 tests passed, including expression 
evaluation and generated code.
   - Existing `FunctionsSuite` test `test vector_dot_product`: passed, covering 
dense and sparse constant vectors.
   - Scalastyle: passed for all changed Scala files.
   - `git diff --check`: passed.
   
   A full SBT build was not run; the local SBT setup was blocked by dependency 
resolution.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-6)
   


-- 
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]

Reply via email to