Updated on 2025-08-25 GMT+08:00

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.

Table 1 Implicit registration syntax

UDF Type

UDF Type (Secondary)

Code Entry

Helpful Link

udf

python

@fabric.udf.python(<Registration parameters>)

Scalar Python UDF Registration Parameters

builtin

@fabric.udf.builtin(<Registration parameters>)

Scalar Builtin UDF 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:

Table 2 DataFrame execution modes

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