Scalar UDF Implicit Registration Syntax
Implicit registration refers to relying on the Python runtime to automatically discover and register Scalar UDFs. You do not need to invasively add registration logic code in their Python scripts. Instead, you can use the @ decorator to annotate the original Python function and then use the identifier of the decorated original Python function in DataFrame to complete the registration. During implicit registration, you do not need to obtain the backend session object when using the @ decorator. The backend session object is later retrieved from the Ibis DataFrame.
Scenarios where implicit registration is recommended: If you wish to register Scalar UDFs in a non-invasive manner and have no requirements regarding the separation of Scalar UDF registration and usage under the same backend connection.
A typical scenario involves writing the entire UDF registration and usage workflow directly within a single user's Python script.
UDF Type |
UDF Type (Secondary) |
Code Entry |
Helpful Link |
---|---|---|---|
udf |
python |
@fabric.udf.python(<Registration parameters>) |
|
builtin |
@fabric.udf.builtin(<Registration parameters>) |
For implicit registration, the timing of the actual registration action differs depending on the DataFrame operation mode (Lazy or Eager).
As mentioned earlier in the Ibis official documentation, DataFrame operations are divided into Eager and Lazy modes, controlled by the ibis.options.interactive configuration item. By default, this is set to false, meaning all DataFrames operate in Lazy mode by default. For these two DataFrame execution modes, the timing of UDF registration varies as described below:
ibis.options.interactive |
DataFrame Execution Mode |
UDF Registration Time |
UDF Usage Time |
---|---|---|---|
False |
Lazy |
When the entire DataFrame calls the execute method |
When the entire DataFrame calls the execute method |
True |
Eager |
First use in DataFrame |
Every use in DataFrame |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot