{"record":{"id":"745e11e092b11de8","repo":"prestodb/presto","slug":"not-supported-745e11","errorCode":"NOT_SUPPORTED","errorMessage":"array_remove does not support arrays with elements that are null or contain null","messagePattern":"array_remove does not support arrays with elements that are null or contain null","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayRemoveFunction.java","lineNumber":90,"sourceCode":"\n    @TypeParameter(\"E\")\n    @SqlType(\"array(E)\")\n    public Block remove(\n            @OperatorDependency(operator = EQUAL, argumentTypes = {\"E\", \"E\"}) MethodHandle equalsFunction,\n            @TypeParameter(\"E\") Type type,\n            @SqlType(\"array(E)\") Block array,\n            @SqlType(\"E\") Object value)\n    {\n        int found = -1;\n        for (int i = 0; i < array.getPositionCount(); i++) {\n            // First see if the element to remove exists in the input array.\n            Object element = readNativeValue(type, array, i);\n            if (element != null) {\n                try {\n                    Boolean result = (Boolean) equalsFunction.invoke(element, value);\n\n                    if (result == null) {\n                        throw new PrestoException(NOT_SUPPORTED, \"array_remove does not support arrays with elements that are null or contain null\");\n                    }\n\n                    if (result) {\n                        found = i;\n                        break;\n                    }\n                }\n                catch (Throwable t) {\n                    throw internalError(t);\n                }\n            }\n        }\n\n        if (found == -1) {\n            // The element doesn't exist\n            return array;\n        }\n","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayRemoveFunction.java#L72-L108","documentation":"Thrown by array_remove when the input array contains null elements (or nested nulls in complex elements). The function's equality-based removal cannot match null elements, so it rejects such input outright rather than silently returning wrong results.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayRemoveFunction.java:90 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Filter null elements from the array before calling array_remove, e.g. array_remove(filter(a, x -> x IS NOT NULL), value)","Ensure the array column does not contain nulls at ingestion time","Use element_at or a CASE expression instead if null handling is required"],"exampleFix":null,"handlingStrategy":"validation","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"}