Skip to main content

register_python_udf_signatures_and_strip

Function register_python_udf_signatures_and_strip 

Source
pub fn register_python_udf_signatures_and_strip(
    ctx: &SessionContext,
    query: &str,
) -> SqlResult<String>
Expand description

Register a signature-only DataFusion scalar UDF for every inline /* krishiv-register-python-udf:name:in,…:out:pickle */ directive in query, so the coordinator can plan a staged query that references it, and return query with the directives stripped (clean SQL for the parser).

The registered UDF’s implementation errors if invoked — it exists only to carry the name, argument types, and return type through planning and physical serialization (the plan references the UDF by name; the executor supplies the real worker-backed implementation on decode). Marked Volatile so the optimizer never tries to const-fold it at plan time. Aggregate directives (python-udaf) are intentionally left in place: staged aggregation is not planned here, so those queries fall back to the single-task path.