PG1204 opened a new issue, #8728:
URL: https://github.com/apache/texera/issues/8728

   ### Task Summary
   
   ### Task Summary
   
   The four legacy Hugging Face operators validate their configuration in three 
different ways and none of them check the input column they read. Bring them to 
one contract.
   
   ### Context
   
   `getOutputSchemas` behaves differently in each operator when a result 
attribute is empty:
   
   - `HuggingFaceSpamSMSDetectionOpDesc` and 
`HuggingFaceSentimentAnalysisOpDesc` `return null`
   - `HuggingFaceTextSummarizationOpDesc` throws `RuntimeException("Result 
attribute name should be given")`
   - `HuggingFaceIrisLogisticRegressionOpDesc` throws `RuntimeException("Result 
attribute name should not be empty")`
   
   Returning `null` is an outlier in the codebase: of the 61 operators 
implementing `getOutputSchemas`, only these two do it. Six throw and one uses 
`require`.
   
   `HuggingFaceTextSummarizationOpDesc` also still reads the input schema as 
`inputSchemas.values.head` rather than 
`inputSchemas(operatorInfo.inputPorts.head.id)`, which is what #8482 corrected 
in the spam operator. With one input port the two are equivalent, so this is 
consistency rather than a live defect.
   
   Separately, none of the four validate that the column they read exists in 
the input schema, `attribute` for the three text operators, and the four 
numeric columns for iris. A typo surfaces as an error from the generated Python 
at run time instead of a clear message at build time. #7299 added exactly that 
check to the Hugging Face inference operator and is the precedent to follow.
   
   ### Proposed change
   
   Pick one contract for all four and apply it, then add a check that the 
referenced input columns exist (and are numeric, for iris).
   
   The contract is the open question and wants a maintainer's steer: `null` 
matches the two HF operators but almost nothing else in the repo, while 
throwing matches the six operators that do validate. `getOutputSchemas` is 
called while an operator is still being configured, so whichever is chosen must 
stay quiet for a half-filled operator.
   
   ### Required test
   
   Extend each operator's spec to cover the empty and missing-column cases for 
the chosen contract, and keep the existing happy-path assertions.
   
   
   ### Task Type
   
   - [x] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [ ] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other


-- 
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]

Reply via email to