databendlabs/databend · error

not implemented

Error message

not implemented

What it means

Panic from `unimplemented!()` in the SQL binder when converting a UDF definition of the `UDAFServer` variant into a plan UDF. Aggregate UDFs backed by a remote UDAF server cannot yet be created or altered, so `bind_udf_definition` panics with 'not implemented' during CREATE/ALTER UDF planning.

Solutions

  1. Use a supported UDF kind instead: scalar `UDFServer` (remote function) or embedded `UDFScript`.
  2. Remove the UDAF-server function definition from the DDL until server-side aggregate UDFs are released.
  3. If aggregate semantics are needed now, express them with built-in aggregate functions or a lambda-based aggregation.
  4. Optionally replace the panic with a user-facing planner error (ErrorCode::Unimplemented) so callers get a proper error, not a panic.

Example fix

// before
UDFDefinition::UDAFServer { .. } => unimplemented!(),
// after
UDFDefinition::UDAFServer { .. } => Err(ErrorCode::Unimplemented(
    "server-side aggregate UDFs (UDAFServer) are not supported yet",
)),
Defensive patterns

Strategy: validation

Validate before calling

-- guard before running DDL
SELECT function_kind FROM expected_registry WHERE name = 'my_udf';
-- reject if kind == 'aggregate-server' until Databend supports UDAFServer

Type guard

fn is_supported_udf(def: &UDFDefinition) -> bool {
    !matches!(def, UDFDefinition::UDAFServer { .. })
}

Try / catch

match binder.bind_create_udf(stmt) {
    Ok(plan) => execute(plan),
    Err(e) if e.is_panic_or_unimplemented() => {
        return Err("server-side aggregate UDFs are not supported");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Executing `CREATE FUNCTION ... AGGREGATE` (bind_create_udf) or `ALTER FUNCTION` (bind_alter_udf) whose definition is `UDFDefinition::UDAFServer`; the binder at src/query/sql/src/planner/binder/udf.rs:232 panics.

Common situations: Users registering server-side aggregate UDFs expecting parity with scalar UDFs (UDFServer) that is already supported; scripts provisioned from setups that previously allowed UDAF syntax.

Related errors


AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11). Data as JSON: /api/errors/916aea98099a06fe. Report an issue: GitHub.

Appendix: source

Thrown at src/query/sql/src/planner/binder/udf.rs:232

                Ok(UserDefinedFunction {
                    name,
                    description,
                    definition: PlanUDFDefinition::UDFServer(UDFServer {
                        address: address.clone(),
                        arg_names,
                        arg_types: arg_datatypes,
                        return_type,
                        handler: handler.clone(),
                        headers: headers.clone(),
                        language: language.clone(),
                        immutable: *immutable,
                    }),
                    created_on: Utc::now(),
                    update_on: Utc::now(),
                })
            }
            UDFDefinition::UDAFServer { .. } => unimplemented!(),
            UDFDefinition::UDFScript {
                arg_types,
                return_type,
                code,
                handler,
                language,
                runtime_version,
                imports,
                packages,
                immutable,
            } => {
                let parsed_language = language.parse::<UDFLanguage>()?;
                UDFValidator::is_udf_script_allowed(&parsed_language)?;
                let definition = create_udf_definition_script(
                    arg_types,
                    None,
                    return_type,
                    runtime_version,

View on GitHub (pinned to 288d84d76e)