fix(QuiverPlot, RangeSlider, v1.2): retarget numeric attributeTypeRules to real fields - #7011
Open
Yicong-Huang wants to merge 1 commit into
Conversation
…real fields (apache#6810) ### What changes were proposed in this PR? Both `QuiverPlotOpDesc` and `RangeSliderOpDesc` carry a class-level `@JsonSchemaInject` `attributeTypeRules` block that constrains a field named **`value`** to numeric types — but neither operator declares a `value` field, so the rule matches nothing and **no type constraint is applied**. The frontend column pickers therefore allow columns of any type for fields the operator can only handle as numeric, which then fails at chart time instead of being prevented up front. **QuiverPlot** — fields are `x`, `y`, `u`, `v` (all required, no `value`). All four are used as numeric vector coordinates in `ff.create_quiver(x, y, u, v)`, and the generated code even runtime-checks them with `isinstance(value, (int, float))`. So all four must be numeric. **RangeSlider** — fields are `Y-axis` and `X-axis` (no `value`). The y-axis column is aggregated (`groupby(X-axis)[Y-axis].mean()/.sum()`), so it must be numeric; the x-axis is only a grouping key and may be any type. **Fix:** retarget each rule to the real `@JsonProperty` field name(s): ```diff # QuiverPlot - "value": { - "enum": ["integer", "long", "double"] - } + "x": { "enum": ["integer", "long", "double"] }, + "y": { "enum": ["integer", "long", "double"] }, + "u": { "enum": ["integer", "long", "double"] }, + "v": { "enum": ["integer", "long", "double"] } # RangeSlider - "value": { + "Y-axis": { "enum": ["integer", "long", "double"] } ``` ### Any related issues, documentation, discussions? Closes apache#6795 ### How was this PR tested? Added a regression test to each spec that reads the class-level `@JsonSchemaInject` `json()` via reflection and asserts the `attributeTypeRules` keys are the real fields (`x`/`y`/`u`/`v`; `Y-axis`) — not `value` — and that each is constrained to the numeric enum. Both fail on `main` (the key set is `{"value"}`) and pass with this change. ``` sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.visualization.quiverPlot.QuiverPlotOpDescSpec org.apache.texera.amber.operator.visualization.rangeSlider.RangeSliderOpDescSpec" ... Tests: succeeded 12, failed 0, canceled 0, ignored 0, pending 0 All tests passed. ``` ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 4.8) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- (backported from commit 1c411de) Signed-off-by: Kary Zheng <150742834+kz930@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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 #7011 +/- ##
==================================================
- Coverage 53.95% 52.39% -1.56%
- Complexity 1441 2493 +1052
==================================================
Files 809 1077 +268
Lines 34144 42267 +8123
Branches 3448 4548 +1100
==================================================
+ Hits 18421 22146 +3725
- Misses 14815 18815 +4000
- Partials 908 1306 +398
*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:
|
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 #6810 to
release/v1.2, cherry-picked from 1c411de.Source fix only. Test changes from #6810 were omitted (the touched specs do not exist on
release/v1.2or depend on main-only test infrastructure); only the source fix is carried over, per maintainer guidance.Any related issues, documentation, discussions?
Backport of #6810. Originally linked #6795.
How was this PR tested?
Release-branch CI runs on this PR. Source change cherry-picked cleanly; test changes intentionally dropped.
Was this PR authored or co-authored using generative AI tooling?
Yes — backport prepared with Claude Code (mechanical cherry-pick + conflict resolution; the change itself is #6810 by its original author).
🤖 Generated with Claude Code