fix: companionModelClassName no longer returns generic type variable - #2195
Merged
Mark Hamilton (mhamilton723) merged 6 commits intoApr 9, 2024
Merged
Conversation
Brendan Walsh (BrendanWalsh)
requested a review
from Mark Hamilton (mhamilton723)
as a code owner
April 7, 2024 13:17
Brendan Walsh (BrendanWalsh)
force-pushed
the
pygen
branch
from
April 7, 2024 13:18
bf94e61 to
bc5d985
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2195 +/- ##
==========================================
- Coverage 85.91% 83.59% -2.33%
==========================================
Files 329 329
Lines 17086 17089 +3
Branches 1515 1523 +8
==========================================
- Hits 14680 14285 -395
- Misses 2406 2804 +398 ☔ View full report in Codecov by Sentry. |
Collaborator
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| override val uid: String = "test" | ||
| } | ||
|
|
||
| private[codegen] class TestRegressor extends Regressor[Vector, TestRegressor, TestRegressorModel] with Wrappable { |
Contributor
There was a problem hiding this comment.
will this end up in the python bindings?
Brendan Walsh (BrendanWalsh)
force-pushed
the
pygen
branch
from
April 9, 2024 19:20
f74663a to
0e9c0e6
Compare
Mark Hamilton (mhamilton723)
approved these changes
Apr 9, 2024
Rana Singh (ranadeepsingh)
pushed a commit
to ranadeepsingh/SynapseML
that referenced
this pull request
Aug 7, 2026
## Summary Update the previously dormant Wrappable companion-model test to expect the actual top-level TestRegressorModel name and remove imports left behind when the fixture moved to its own source file. ## Prompting Intent Prepare PR microsoft#2590 for merge by diagnosing and fixing its Azure core-unit failure after codegen tests were added to the normal PR shard. Keep the correction narrow and preserve the PR's goal of making all code generation behavior continuously validated. ## Linked Sources - Pull request: microsoft#2590 - Failed Azure build: https://msdata.visualstudio.com/b9b2accc-2d1c-45b3-9d24-0eb5d78cc47f/_build/results?buildId=230147126 - Original companion-model fix: microsoft#2195 ## Rationale The fixture has been a package-level class since microsoft#2195, so Scala reflection correctly returns com.microsoft.azure.synapse.ml.codegen.TestRegressorModel. The obsolete nested-class expectation went unnoticed because the codegen package was not part of the core CI shard. Correcting the assertion is preferable to excluding the suite or changing production reflection logic that already returns the right public class name. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 81d39bfc-927c-418a-90a8-e0f2cd8fc128
Rana Singh (ranadeepsingh)
pushed a commit
to ranadeepsingh/SynapseML
that referenced
this pull request
Aug 7, 2026
## Summary Limit the dormant Wrappable test correction to the stale expected class name, retaining the surrounding release-branch source shape so the already-equivalent Spark 4.1 change merges without conflict. ## Prompting Intent Prepare PR microsoft#2590 for merge after Azure confirmed that its product and codegen changes replayed onto Spark 4.1 but the broader test cleanup conflicted with an equivalent release-branch assertion fix. Preserve the corrected master test while keeping the compatibility patch minimal. ## Linked Sources - Pull request: microsoft#2590 - Failed release replay: https://msdata.visualstudio.com/b9b2accc-2d1c-45b3-9d24-0eb5d78cc47f/_build/results?buildId=230156549 - Original companion-model fix: microsoft#2195 ## Rationale Spark 4.1 already expects the top-level TestRegressorModel name. Reverting unrelated import and formatting cleanup leaves a one-line semantic correction whose three-way merge recognizes that identical release change, while continuing to make the newly enabled master test pass. This avoids adding release-specific exclusions or weakening codegen CI coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 81d39bfc-927c-418a-90a8-e0f2cd8fc128
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.
This commit addresses an issue in the companionModelClassName method where the resolution of the companion model's class name was not accurately reflecting the intended Python package path for Regression models.
"from M import M", where M is the name of MLLib's
Regressorclass' concrete model type parameter:https://github.com/apache/spark/blob/45ba9224602eb18fe45e339cbb8cf2e8a4924f0b/mllib/src/main/scala/org/apache/spark/ml/regression/Regressor.scala#L28
Implemented reflection with scala.reflect.runtime.universe._ to accurately access and utilize type information at runtime, overcoming Scala's type erasure limitations.
Tested against the existing method for all wrappable classes and found the only divergence to be the instance where it fixed the broken wrapped regressor. Added a regression test for this scenario.