kz930 opened a new pull request, #8303: URL: https://github.com/apache/texera/pull/8303
### What changes were proposed in this PR? The Machine Learning Scorer accepts settings it cannot score, and it says so only once the generated Python has already failed. This adds the two checks that report them in the editor instead. The first is on the schema. The Scorer Functions multi-select starts empty and nothing marks it required, so an untouched operator runs and then fails with `KeyError: ''`. The rule has to be conditional: there are two metric lists, one per branch of the Regression switch, and only one of them is visible at a time, so a flat `required` on both could never be satisfied. Stated as a conditional `required` plus `minItems`, only the visible list is asked for, and the editor already renders the marker for a rule in that form. The second is on the pair of column settings. Actual Value and Predicted Value hold one label read twice, so they have to be comparable, and `getOutputSchemas` is where both the settings and the upstream schema are in hand. It now reports a column the input table does not hold, a non-numeric column on the regression branch, and a classification pair that mixes a number with a string. That last one is the reason this is worth catching: with Accuracy the mismatched pair does not fail at all, it scores 0.0, which reads as a model that never predicts correctly. The check reads types, not values. A DOUBLE label column of 0.0 / 1.0 is a legitimate classification target even though a continuous one is not, and a schema cannot tell the two apart, so pinning the columns to a type would refuse configurations that work today. ### Any related issues, documentation, discussions? Closes #8302 ### How was this PR tested? Five cases were added to `MachineLearningScorerOpDescSpec`, covering each rejection with the message it produces and both cases that have to stay accepted: an INTEGER label against a LONG prediction, and a half-filled operator whose second column is still unpicked, where the existing required marker already speaks for itself. The schema rule was checked by generating the operator's JSON Schema and running it through the same AJV configuration the editor validates with. A classification config carrying at least one metric is valid; an empty or absent `classificationFlag` is not; the same holds for `regressionFlag` on the other branch; and a leftover empty list on the branch that is hidden does not block the branch in use. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5) -- 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]
