GitHub user chenlica added a comment to the discussion: Feature Proposal: 
Extend Python UDF operators to allow users to modify parameters without editing 
the code

I also believe option 1 is better.  Here are more insights from the perspective 
of the engine.

In the Amber engine, the UDF's Python code is sent from JVM to PVM as a 
**string** to be executed on the PVM.

In option 1, the user-provided parameters are passed from the top-left operator 
as two **data tuples** to the Python UDF operator.  In the UDF, the Python code 
for port 0, which runs on PVM, parses the data tuples sent from JVM to retrieve 
the two parameters.  The Python code for port 1, which also runs on the same 
PVM, uses the two parameters in its computation.

In option 2, the parameters are provided by the user through the frontend 
fields of the Python UDF (as part of its property panel).  For these parameters 
to be obtained by the Python code on PVM, we need to send them from JVM to PVM 
as a control message, which is doable but not easy.  We could avoid sending a 
control message by using a "Python code template" on JVM and plugging in the 
user's parameters, but that's NOT how our engine generates the Python code.

Therefore, option 1 is cleaner and easier to adopt.

GitHub link: 
https://github.com/apache/texera/discussions/4154#discussioncomment-15481647

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]

Reply via email to