sshiv012 opened a new pull request, #8770:
URL: https://github.com/apache/texera/pull/8770

   ### What changes were proposed in this PR?
   
   The Python UDF, 2-in Python UDF and 1-out Python UDF templates were fully 
commented out, including `from pytexera import *`. They also never said to keep 
only one class. So uncommenting a class failed with `NameError`, and keeping 
several failed the one-Operator check.
   
   - `from pytexera import *` is now active.
   - A short header explains the rules:
   
   ```python
   # Keep exactly ONE class below: uncomment it and delete the others.
   # Its method must match its base class:
   #   UDFOperatorV2 -> process_tuple, UDFBatchOperator -> process_batch,
   #   UDFTableOperator -> process_table
   # Always `yield` results (never `return`). Put setup code in open();
   # if you override __init__, call super().__init__() first.
   ```
   
   - The 2-in template also says that port 0 (model) is read before port 1 
(tuples).
   - The UiParameter lines are kept.
   - The template copies in 
`docs/reference/operators/user-defined-functions/python/` are synced.
   
   Saved workflows keep their own code and are not affected.
   
   Before, every line started with `#`:
   
   ```python
   # Choose from the following templates:
   # ...
   # from pytexera import *
   #
   # class ProcessTupleOperator(UDFOperatorV2):
   # ...
   ```
   
   After, in the code editor:
   
   `[upload: template-after.png]`
   
   ### Any related issues, documentation, discussions?
   
   Part of #8736. Split out of #8737.
   
   ### How was this PR tested?
   
   - The specs for all three descriptors now read the `defaultValue`. They 
check that the import is the only active line and the header is there, and that 
uncommenting any one class leaves exactly one active class.
   - New Python tests load the template shape and check that uncommenting one 
class loads without adding an import.
   - `WorkflowOperator/testOnly org.apache.texera.amber.operator.udf.python.*`, 
scalafmtCheck, pytest and ruff all pass.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.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]

Reply via email to