{"record":{"id":"6e2df133bacf1cdf","repo":"prestodb/presto","slug":"not-supported-6e2df1","errorCode":"NOT_SUPPORTED","errorMessage":"contains does not support arrays with elements that are null or contain null","messagePattern":"contains 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/ArrayContains.java","lineNumber":203,"sourceCode":"                checkNotIndeterminate(result);\n                if (result) {\n                    return true;\n                }\n            }\n            catch (Throwable t) {\n                throw internalError(t);\n            }\n        }\n        if (foundNull) {\n            return null;\n        }\n        return false;\n    }\n\n    private static void checkNotIndeterminate(Boolean equalsResult)\n    {\n        if (equalsResult == null) {\n            throw new PrestoException(NOT_SUPPORTED, \"contains does not support arrays with elements that are null or contain null\");\n        }\n    }\n}\n","sourceCodeStart":185,"sourceCodeEnd":207,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayContains.java#L185-L207","documentation":"array_contains uses the type's equal operator, which for indeterminate (NULL or NULL-containing) inputs returns NULL. checkNotIndeterminate rejects a NULL equality result with NOT_SUPPORTED because a NULL answer cannot be coerced to true/false for the contains semantics. Presto deliberately disallows rather than silently returning NULL/false.","triggerScenarios":"contains(array_with_nulls, x) or contains(array_of_rows, x) where any array element is NULL or is a composite (row/array/map) containing a NULL, making the equality comparison indeterminate.","commonSituations":"Arrays built from outer joins or aggregations that introduce NULL elements; searching arrays of ROW/ARRAY types where nested fields can be NULL.","solutions":["Filter NULL elements first: contains(filter(arr, x -> x IS NOT NULL), value).","Use a lambda with any_match(arr, x -> x = value) if NULL-tolerant semantics are acceptable.","Coalesce NULL elements to a sentinel before the contains call.","For composite elements, compare a non-nullable extracted field instead of the whole value."],"exampleFix":"// before\ncontains(a, 5) -- a contains NULLs\n// after\ncontains(filter(a, x -> x IS NOT NULL), 5)","handlingStrategy":"validation","validationCode":"SELECT contains(array_remove(a, NULL), v) -- or verify: cardinality(filter(a, x -> x IS NULL)) = 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["array_remove(a, NULL) before contains","Use any_match for NULL-tolerant membership tests","Avoid NULLs entering arrays from outer joins via COALESCE"],"tags":["array","null","not-supported"],"backgroundTag":"null-value-not-supported","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}