fix(dendrogram, v1.2): pass the color threshold to scipy as a number - #7306
Open
kz930 wants to merge 1 commit into
Open
fix(dendrogram, v1.2): pass the color threshold to scipy as a number#7306kz930 wants to merge 1 commit into
kz930 wants to merge 1 commit into
Conversation
…e#7234) ### What changes were proposed in this PR? Dendrogram's Color Threshold could not be set at all: - the field was declared as a string and spliced into the generated Python as a decode expression, so scipy received `'3'` rather than `3` and raised `UFuncTypeError` comparing it against the linkage distances - the only values that plotted were a blank field and the literal `default`, and scipy documents those as equivalent — both mean 0.7 × max distance — so nothing a user could type ever changed the coloring This PR declares the field as `Option[Double]`: - the number is spliced as a literal, so scipy gets a number - an unset threshold stays `None`, the same 0.7 × max distance a blank field already meant - `@JsonDeserialize(contentAs = ...)` names the boxed class: Scala erases `Option`'s element type, so without it Jackson leaves the raw JSON value inside the Option and the first use throws `ClassCastException`, and the primitive class would read a blank as 0 — every link colored the same rather than "unset" Compatibility: a numeric string saved earlier still reads as a number, and those workflows were failing before this change anyway. A workflow that stored the literal `default` no longer loads; clearing the field plots the identical chart. ### Any related issues, documentation, discussions? Fixes apache#7232. ### How was this PR tested? - the operator's existing spec updated: a configured threshold is asserted to reach the template as `color_threshold=42.5`, not as a decoded string - deserialization tests for a JSON number, a numeric string, blank, null and absent — plus one that uses the value as a number, the case a round trip cannot catch - ran the generated Python against a pandas DataFrame: `color_threshold=3.0` plots a figure and so does the unset case, while passing the same value as a string, which is what the operator does today, raises `UFuncTypeError` - whole workflow-operator module: 2020 tests passing, `scalafmtCheck` clean ### Was this PR authored or co-authored using generative AI tooling? (backported from commit 351ce20) Generated-by: Claude Code (claude-opus-5[1m])
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v1.2 #7306 +/- ##
==================================================
- Coverage 52.87% 52.83% -0.04%
+ Complexity 2526 2520 -6
==================================================
Files 1078 1078
Lines 42369 42367 -2
Branches 4566 4565 -1
==================================================
- Hits 22404 22386 -18
- Misses 18646 18656 +10
- Partials 1319 1325 +6
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
xuang7
approved these changes
Aug 4, 2026
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 PR?
Backport of #7234 to
release/v1.2. The automated backport, #7291, landed with cherry-pick conflict markers on a branch in this repository that I cannot push to, so this PR carries the resolved commit from my fork instead.The conflict was in
createDendrogram():release/v1.2still has the older body, and the cherry-picked commit rewrites the same lines. The resolution takes the cherry-picked side. It is line-for-line identical to what landed onmain, plus the three assert messages that already exist onmainand that the accompanying spec asserts on.Any related issues, documentation, discussions?
Backport of #7234, which closed #7232. Supersedes #7291.
How was this PR tested?
DendrogramOpDescSpecon this branch: 9 tests, all passing.scalafmtCheckAllandscalafixAll --checkare both clean.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (claude-opus-5[1m])