{"record":{"id":"abe8e41495003543","repo":"prestodb/presto","slug":"function-implementation-missing-abe8e4","errorCode":"FUNCTION_IMPLEMENTATION_MISSING","errorMessage":"Unsupported array element type for array_normalize function: %s","messagePattern":"Unsupported array element type for array_normalize function: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayNormalizeFunction.java","lineNumber":70,"sourceCode":"        return normalizeArray(elementType, block, p, DOUBLE_VALUE_ACCESSOR);\n    }\n\n    @TypeParameter(\"T\")\n    @TypeParameterSpecialization(name = \"T\", nativeContainerType = long.class)\n    @SqlType(\"array(T)\")\n    @SqlNullable\n    public static Block normalizeRealArray(\n            @TypeParameter(\"T\") Type elementType,\n            @SqlType(\"array(T)\") Block block,\n            @SqlType(\"T\") long p)\n    {\n        return normalizeArray(elementType, block, Float.intBitsToFloat((int) p), REAL_VALUE_ACCESSOR);\n    }\n\n    private static Block normalizeArray(Type elementType, Block block, double p, ValueAccessor valueAccessor)\n    {\n        if (!(elementType instanceof RealType) && !(elementType instanceof DoubleType)) {\n            throw new PrestoException(\n                    FUNCTION_IMPLEMENTATION_MISSING,\n                    format(\"Unsupported array element type for array_normalize function: %s\", elementType.getDisplayName()));\n        }\n        checkCondition(p >= 0, INVALID_FUNCTION_ARGUMENT, \"array_normalize only supports non-negative p: %s\", p);\n\n        if (p == 0) {\n            return block;\n        }\n\n        int elementCount = block.getPositionCount();\n        double pNorm = 0;\n        for (int i = 0; i < elementCount; i++) {\n            if (block.isNull(i)) {\n                return null;\n            }\n            pNorm += Math.pow(Math.abs(valueAccessor.getValue(elementType, block, i)), p);\n        }\n        if (pNorm == 0) {","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayNormalizeFunction.java#L52-L88","documentation":"Type guard in ArrayNormalizeFunction.normalizeArray: array_normalize only supports DOUBLE and REAL element types (numeric arrays with the required value accessors); any other element type reaching the shared normalize helper is rejected.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayNormalizeFunction.java:70 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use array_normalize only on array(double) or array(real)","Cast the array to array(double) before calling array_normalize","Implement normalization manually with transform for other element types"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}