Skip to main content

Module ai_udf

Module ai_udf 

Source
Expand description

Marker UDFs for the ai_* SQL functions (rewritten by the AI operator). Marker UDFs for the ai_* SQL functions.

These exist so that ai_classify, ai_embed, … resolve as known functions with a fixed return type, the same way tumble() and watermark() are markers the engine rewrites rather than evaluates. In the normal path the AI detector lifts an ai_* call out of the projection and replaces it with a computed column before DataFusion plans the residual query, so these markers are never invoked. If one survives to execution — used in a position the detector does not rewrite — invoke returns a clear error rather than producing a wrong value.

The function name → return type map here must stay in step with the name → task map in laminar-db’s sql_analysis (the eight locked AI functions). The crate does not depend on laminar-ai, so the two lists are intentionally independent.

Structs§

AiFunctionMarker
A placeholder scalar UDF for an ai_* function. Holds the function’s name and fixed return type; errors if evaluated directly.

Functions§

ai_function_markers
Build the eight ai_* marker UDFs, ready to register on a session context.