{"record":{"id":"53b64db34802c0fe","repo":"databendlabs/databend","slug":"not-implemented","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/query/script_udf_support/src/udaf_script.rs","lineNumber":327,"sourceCode":") -> Result<Arc<dyn AggregateFunction>> {\n    let UDFScriptCode { language, code, .. } = code;\n    let runtime = match language {\n        UDFLanguage::JavaScript => {\n            let builder = JsRuntimeBuilder {\n                name,\n                code: String::from_utf8(code.to_vec())?,\n                state_type: ArrowType::Struct(\n                    state_fields\n                        .iter()\n                        .map(|f| f.into())\n                        .collect::<Vec<arrow_schema::Field>>()\n                        .into(),\n                ),\n                output_type,\n            };\n            UDAFRuntime::JavaScript(JsRuntimePool::new(builder))\n        }\n        UDFLanguage::WebAssembly => unimplemented!(),\n        #[cfg(not(feature = \"python-udf\"))]\n        UDFLanguage::Python => {\n            return Err(ErrorCode::EnterpriseFeatureNotEnable(\n                \"Failed to create python script udf\",\n            ));\n        }\n        #[cfg(feature = \"python-udf\")]\n        UDFLanguage::Python => {\n            let builder = python_pool::PyRuntimeBuilder {\n                name,\n                code: String::from_utf8(code.to_vec())?,\n                state_type: ArrowType::Struct(\n                    state_fields\n                        .iter()\n                        .map(|f| f.into())\n                        .collect::<Vec<arrow_schema::Field>>()\n                        .into(),\n                ),","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/query/script_udf_support/src/udaf_script.rs#L309-L345","documentation":"`create_udaf_script_function` builds the runtime for a script-based aggregate UDF. Only JavaScript (and Python behind a feature flag) are wired up; the WebAssembly branch panics with `unimplemented!`, so any attempt to register a WASM UDAF aborts the process.","triggerScenarios":"Creating a script UDAF with `LANGUAGE WEBASSEMBLY` (e.g. CREATE AGGREGATE FUNCTION ... LANGUAGE WEBASSEMBLY), which routes into the UDFLanguage::WebAssembly arm of the builder in udaf_script.rs.","commonSituations":"Following old or aspirational docs/examples that mention WebAssembly UDFs; migrating a UDF definition written for an engine that supports WASM UDAFs to Databend.","solutions":["Rewrite the aggregate function as a JavaScript script UDAF (LANGUAGE JAVASCRIPT) instead of WebAssembly","If Python is available in your edition, deploy with the python-udf feature enabled and use LANGUAGE PYTHON","File/track a Databend feature request for WebAssembly UDAF support"],"exampleFix":"// before\nCREATE AGGREGATE FUNCTION my_agg AS (x) LANGUAGE WEBASSEMBLY ...;\n// after\nCREATE AGGREGATE FUNCTION my_agg AS (x DOUBLE) RETURNS DOUBLE LANGUAGE JAVASCRIPT $$ ... $$;","handlingStrategy":"validation","validationCode":"if (udafDef.language.toUpperCase() === \"WEBASSEMBLY\") {\n  throw new Error(\"WebAssembly UDAF is not implemented; use JAVASCRIPT or PYTHON\");\n}","typeGuard":"function hasSupportedUdafLanguage(def) {\n  return [\"JAVASCRIPT\", \"PYTHON\"].includes((def.language || \"\").toUpperCase());\n}","tryCatchPattern":"try {\n  await createAggregateFunction(udafDef);\n} catch (e) {\n  if (isNotImplementedPanic(e)) {\n    console.error(`Language ${udafDef.language} unsupported for UDAF; falling back to JAVASCRIPT`);\n    return createAggregateFunction({ ...udafDef, language: \"JAVASCRIPT\" });\n  }\n  throw e;\n}","preventionTips":["Do not define script UDAFs with LANGUAGE WEBASSEMBLY until support lands; use JavaScript","Verify feature flags (python-udf) before choosing PYTHON as the UDAF language","Validate UDF definitions in CI against the set of languages your Databend build actually supports"],"tags":["rust","udf","webassembly","unimplemented"],"backgroundTag":"unsupported-enum-value","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}