docs: clarify Function creation and registration boundaries

This commit is contained in:
Xuanwo
2026-09-15 14:55:25 +08:00
parent ee19b71776
commit df661cdab0
3 changed files with 14 additions and 11 deletions
+9 -7
View File
@@ -693,19 +693,20 @@ class DBConnection(EnforceOverrides):
raise NotImplementedError("serialize is not supported for this connection type")
def create_function(self, definition: UdfDefinition) -> FunctionVersion:
"""Register a scalar Python UDF and wait for its immutable version.
"""Build and register a scalar Python UDF, then return its version.
The server builds the OCI image and registers the completed artifact.
This is the blocking counterpart of :meth:`create_function_async`.
Local connections raise ``NotImplementedError``.
"""
return self.create_function_async(definition).wait()
def create_function_async(self, definition: UdfDefinition) -> Job[FunctionVersion]:
"""Register a scalar Python UDF through the remote Function catalog.
"""Submit a scalar Python UDF for building and registration.
Submission returns a typed job. The immutable Function version becomes
available only when :meth:`Job.wait` succeeds. Local connections raise
``NotImplementedError``.
The server-side job builds the OCI image, then registers the completed
artifact. Waiting on the job returns the immutable Function version.
Local connections raise ``NotImplementedError``.
"""
raise NotImplementedError(
"Function catalog operations are not supported for this connection type"
@@ -2267,9 +2268,10 @@ class AsyncConnection(object):
async def create_function_async(
self, definition: UdfDefinition
) -> AsyncJob[FunctionVersion]:
"""Register a scalar Python UDF through the remote Function catalog.
"""Submit a scalar Python UDF for building and registration.
The returned typed job resolves to the immutable Function version.
The server-side job builds the OCI image, then registers the completed
artifact. Waiting on the job returns the immutable Function version.
Local connections raise ``NotImplementedError``.
"""
if not isinstance(definition, UdfDefinition):
+4 -3
View File
@@ -581,10 +581,11 @@ impl Connection {
)
}
/// Register a Python callable as a new immutable Function version.
/// Build and register a Python callable as an immutable Function version.
///
/// Registration is remote-only and always asynchronous. Waiting on the
/// returned typed job yields the durable [`crate::function::FunctionVersion`].
/// The server-side job builds the OCI image, then registers the completed
/// artifact. Waiting on the returned typed job yields the durable
/// [`crate::function::FunctionVersion`]. Creation is remote-only.
/// Local databases return [`Error::NotSupported`].
pub async fn create_function_async(
&self,
+1 -1
View File
@@ -294,7 +294,7 @@ pub trait Database:
///
/// See [`CloneTableRequest`] for detailed documentation and examples.
async fn clone_table(&self, request: CloneTableRequest) -> Result<Arc<dyn BaseTable>>;
/// Register an immutable Function version through the remote catalog.
/// Submit a Function creation job that builds an image and registers it.
async fn create_function_async(
&self,
_request: crate::function::FunctionRegistrationRequest,