prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

contains does not support arrays with elements that are null or contain null

What it means

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.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayContains.java:203

                checkNotIndeterminate(result);
                if (result) {
                    return true;
                }
            }
            catch (Throwable t) {
                throw internalError(t);
            }
        }
        if (foundNull) {
            return null;
        }
        return false;
    }

    private static void checkNotIndeterminate(Boolean equalsResult)
    {
        if (equalsResult == null) {
            throw new PrestoException(NOT_SUPPORTED, "contains does not support arrays with elements that are null or contain null");
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Filter NULL elements first: contains(filter(arr, x -> x IS NOT NULL), value).
  2. Use a lambda with any_match(arr, x -> x = value) if NULL-tolerant semantics are acceptable.
  3. Coalesce NULL elements to a sentinel before the contains call.
  4. For composite elements, compare a non-nullable extracted field instead of the whole value.

Example fix

// before
contains(a, 5) -- a contains NULLs
// after
contains(filter(a, x -> x IS NOT NULL), 5)
Defensive patterns

Strategy: validation

Validate before calling

SELECT contains(array_remove(a, NULL), v) -- or verify: cardinality(filter(a, x -> x IS NULL)) = 0

Prevention

When it happens

Trigger: 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.

Common situations: Arrays built from outer joins or aggregations that introduce NULL elements; searching arrays of ROW/ARRAY types where nested fields can be NULL.

Understand the failure class

Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/6e2df133bacf1cdf. Report an issue: GitHub.