[SPARK-58177][GRAPHX] Fix wrong operand in SVD++ aggregateMessages combiner#57314
Closed
Ma77Ball wants to merge 1 commit into
Closed
[SPARK-58177][GRAPHX] Fix wrong operand in SVD++ aggregateMessages combiner#57314Ma77Ball wants to merge 1 commit into
Ma77Ball wants to merge 1 commit into
Conversation
Contributor
Author
|
cc @srowen @dongjoon-hyun @HyukjinKwon, PTAL when you have time. |
srowen
approved these changes
Jul 16, 2026
srowen
left a comment
Member
There was a problem hiding this comment.
Yep, good catch, you are right.
I've long since lost my setup to merge PRs, so I hope someone else who's active can merge this.
Contributor
Author
|
Hello @srowen, thank you for the information and I'll keep that in mind for the future. I greatly appreciate the review. |
HyukjinKwon
approved these changes
Jul 19, 2026
Contributor
Author
|
Thank you @uros-b and @HyukjinKwon for the review. For the regression test, I can open another Jira ticket and PR to work on this. Or would you prefer it to be done on this PR? |
Yicong-Huang
approved these changes
Jul 20, 2026
Yicong-Huang
left a comment
Contributor
There was a problem hiding this comment.
I will help merge this then. Also LGTM
Yicong-Huang
pushed a commit
that referenced
this pull request
Jul 20, 2026
…mbiner
### What changes were proposed in this pull request?
Fix the Phase-2 `aggregateMessages` combiner in `SVDPlusPlus.run`, which seeded the `_2` accumulator from the wrong operand:
```diff
- val out2 = g2._2.clone()
+ val out2 = g1._2.clone()
BLAS.nativeBLAS.daxpy(out2.length, 1.0, g2._2, 1, out2, 1)
```
### Why are the changes needed?
The next line adds `g2` on top, so the result should be `g1 + g2`. Because the code started with `g2` instead of `g1`, it computed `g2 + g2` and discarded `g1`. Any node with two or more edges ended up with the wrong value. The matching code just below already does it the right way (`g1 + g2`).
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Verified with a unit test (UT) that feeds two concrete updates through the combiner and checks the merged `_2` value, plus the existing suite: `build/sbt "graphx/testOnly org.apache.spark.graphx.lib.SVDPlusPlusSuite"` passes. With the faulty code, the output does not match the expected sum; with the fix, it does:
| | `_2` value |
|---|---|
| Input `g1._2` | `[3, 4]` |
| Input `g2._2` | `[30, 40]` |
| Expected (`g1._2 + g2._2`) | `[33, 44]` |
| Faulty code output | `[60, 80]` (wrong: `2 * g2._2`, drops `g1._2`) |
| Corrected code output | `[33, 44]` (correct) |
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #57314 from Ma77Ball/SPARK-58177.
Authored-by: Matthew B. <mgball@uci.edu>
Signed-off-by: Yicong-Huang <17627829+Yicong-Huang@users.noreply.github.com>
(cherry picked from commit b5e242e)
Signed-off-by: Yicong-Huang <17627829+Yicong-Huang@users.noreply.github.com>
Contributor
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Fix the Phase-2
aggregateMessagescombiner inSVDPlusPlus.run, which seeded the_2accumulator from the wrong operand:Why are the changes needed?
The next line adds
g2on top, so the result should beg1 + g2. Because the code started withg2instead ofg1, it computedg2 + g2and discardedg1. Any node with two or more edges ended up with the wrong value. The matching code just below already does it the right way (g1 + g2).Does this PR introduce any user-facing change?
No
How was this patch tested?
Verified with a unit test (UT) that feeds two concrete updates through the combiner and checks the merged
_2value, plus the existing suite:build/sbt "graphx/testOnly org.apache.spark.graphx.lib.SVDPlusPlusSuite"passes. With the faulty code, the output does not match the expected sum; with the fix, it does:_2valueg1._2[3, 4]g2._2[30, 40]g1._2 + g2._2)[33, 44][60, 80](wrong:2 * g2._2, dropsg1._2)[33, 44](correct)Was this patch authored or co-authored using generative AI tooling?
No