The GitHub Actions job "Required Checks" on texera.git/main has succeeded.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
728d5cd7039257acfb54dfeef73f87db053e21f6 / Prateek Ganigi 
<[email protected]>
fix(workflow-operator): one validation contract for the four legacy Hugging 
Face operators (#9209)

### What changes were proposed in this PR?

The four legacy Hugging Face operators (Spam Detection, Sentiment
Analysis, Text Summarization and Iris Logistic Regression) now validate
their configuration the same way in `getOutputSchemas`, through one
shared helper, `HuggingFaceSchemaValidation`:

- **They throw and never return `null`,** as @Ma77Ball recommended on
#8728. Spam and Sentiment used to return `null` for an empty result
column. The compiler runs `getOutputSchemas` inside a `Try` and stores a
thrown error on the output port. A returned `null` counted as success,
then failed one line later in `PhysicalOp.propagateSchema`
(`schemaMapping.foldLeft`) with a `NullPointerException`, so the user
saw an NPE instead of a message. Summarization and Iris already threw,
but with generic messages. All four now name the field, e.g. `Spam
result attribute cannot be empty`.
- **Input columns are checked at build time.** The column each operator
reads (`Attribute` for the three text operators, the two petal columns
for Iris) must be set and present in the input table. The match is
exact-case: `Schema` lookups ignore case, but the generated Python does
not. The error lists the available columns, as #7299's does. Iris's
petal columns must also be numeric (integer, long or double), matching
its existing frontend type rule.
- **Summarization reads its input schema by port id**
(`inputSchemas(operatorInfo.inputPorts.head.id)`), as the other three
do, instead of `inputSchemas.values.head`.

Two corrections to the text of #8728. Iris reads two input columns
(petal length and petal width), not four. And #7299's check runs in the
generated Python at run time, so it is the precedent for the message
wording, not for where the check lives.

### Any related issues?

Closes #8728

### How was this PR tested?

The tests were written first. 22 new or rewritten tests across the four
specs failed against `main` for the expected reasons; Spam's and
Sentiment's propagation tests failed with the `NullPointerException`
itself. All 22 pass with the change, and reverting the four operators
makes exactly those 22 fail again. The six tests that asserted `null`
now assert the thrown message. The Spam and Iris happy-path inputs
gained the columns those operators read, and their assertions are
unchanged.

The full `WorkflowOperator` suite passes: 2756 tests, 0 failures, with 1
cancelled and 2 pending, none of them in the Hugging Face suites. The
generated Python of all 117 operators compiles, and scalafmt and
scalafix are clean.

### Was this PR authored or co-authored using generative AI tooling?

Yes, this PR was co-authored with Claude in compliance with ASF policy.

Report URL: https://github.com/apache/texera/actions/runs/45293777187

With regards,
GitHub Actions via GitBox

Reply via email to