uros-b opened a new pull request, #58075:
URL: https://github.com/apache/spark/pull/58075

   ### What changes were proposed in this pull request?
   
   Adds a short descriptive message to the 14 bare `require(...)` checks in 
`ALS.scala`, naming the values involved:
   
   ```scala
   require(c >= 0.0, s"Observation weight must be non-negative but found $c.")
   require(a.length == k, s"Observation length ${a.length} must equal rank $k.")
   require(blockId < numBlocks, s"blockId $blockId must be less than numBlocks 
$numBlocks.")
   ```
   
   ### Why are the changes needed?
   
   When one of these guards trips it currently produces only `requirement 
failed`, which gives no indication of which invariant broke in a long-running 
factorization job. The file already establishes the pattern: `require(numBlocks 
> 0, s"numBlocks must be positive but found $numBlocks.")`. This mirrors 
SPARK-58621, which did the same for `SummarizerBuffer`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Conditions and exception types are unchanged; only message text is added.
   
   ### How was this patch tested?
   
   Existing `ALSSuite` coverage applies. Every condition was verified 
byte-identical after the change, and no test asserts on these messages: the 
suite's `getMessage` assertions target the unrelated `ALS only supports 
non-Null values` / `must be of type numeric` strings, and the 
`intercept[IllegalArgumentException]` blocks check only the exception type.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8)
   


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