prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

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

What it means

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.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayRemoveFunction.java:90

    @TypeParameter("E")
    @SqlType("array(E)")
    public Block remove(
            @OperatorDependency(operator = EQUAL, argumentTypes = {"E", "E"}) MethodHandle equalsFunction,
            @TypeParameter("E") Type type,
            @SqlType("array(E)") Block array,
            @SqlType("E") Object value)
    {
        int found = -1;
        for (int i = 0; i < array.getPositionCount(); i++) {
            // First see if the element to remove exists in the input array.
            Object element = readNativeValue(type, array, i);
            if (element != null) {
                try {
                    Boolean result = (Boolean) equalsFunction.invoke(element, value);

                    if (result == null) {
                        throw new PrestoException(NOT_SUPPORTED, "array_remove does not support arrays with elements that are null or contain null");
                    }

                    if (result) {
                        found = i;
                        break;
                    }
                }
                catch (Throwable t) {
                    throw internalError(t);
                }
            }
        }

        if (found == -1) {
            // The element doesn't exist
            return array;
        }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Filter null elements from the array before calling array_remove, e.g. array_remove(filter(a, x -> x IS NOT NULL), value)
  2. Ensure the array column does not contain nulls at ingestion time
  3. Use element_at or a CASE expression instead if null handling is required
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayRemoveFunction.java:90 when the library encounters an invalid state.

Common situations: See trigger scenarios.

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.


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