kz930 opened a new pull request, #7233: URL: https://github.com/apache/texera/pull/7233
### What changes were proposed in this PR? Eight settings across three chart operators accept only numbers — each is used solely as `float(...)` or `int(...)` — but were declared as plain strings, so the form let any text through and each operator then mishandled it differently: - Gauge Chart `delta`, `threshold`; Bullet Chart `thresholdValue` — discarded silently, leaving a finished-looking chart with the indicator missing - Bullet Chart `deltaReference`, step `start`/`end` — error page - Contour Plot `gridSize` — `ValueError`, and the same when left blank This PR declares them as `Option[Double]` / `Option[Int]`: - the form rejects a non-number before the run, and all three operators behave the same way - the generated code no longer parses: values are spliced as numbers, so the conversions, the `try/except ValueError` blocks and Gauge Chart's `json.loads` of its steps are gone, along with an `import json` that became dead - a step whose bounds are not both filled in is dropped while the list is built, which is what Bullet Chart's "Invalid step values" note existed for - `@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 - Gauge Chart's step bounds are included beyond the seven the issue lists — same declaration, same consumer, and a non-numeric bound was swallowed by a bare `except`, plotting the gauge with no steps at all Compatibility: a numeric string saved before this change still loads as a number and a blank one as unset; a workflow that stored a value that is not a number now fails to load rather than silently dropping it — those charts were already rendering without the setting. ### Any related issues, documentation, discussions? Fixes #7213. Dendrogram's Color Threshold shares the declaration but fails differently — spliced as a string, scipy raises on any number, and only a blank field or the literal `default` ever plotted — so it is filed separately as #7232. ### How was this PR tested? - existing specs for the three operators updated to the new types - per field: 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, since a round trip writes a number back and a missing `contentAs` survives it - generated-code tests pin the assignments (`delta_ref = 40.0`, `threshold_val = None`, `grid_size = 10` as the form's default) and the dropped half-filled step - ran the generated Python against a pandas DataFrame for all three operators, configured and left unset: each plots a figure, and the inverted-step case still reports `start ≥ end` - whole workflow-operator module: 2033 tests passing, `scalafmtCheck` clean ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-5[1m]) -- 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]
