prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

%s

What it means

During histogram lookup, groupAndValueMatches compares an existing entry's key with the incoming value using the key type's equality. Some Presto types' equalTo does not support certain comparisons and throws NotSupportedException; Presto wraps it in a PrestoException with NOT_SUPPORTED so the failure surfaces as a clean 'not supported' rather than a raw internal exception.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/histogram/GroupedTypedHistogram.java:509

                }
                else {
                    // keep looking
                    int probe = nextProbe(probeCount);
                    bucketId = nextBucketId(originalBucketId, mask, probe);
                    probeCount++;
                }
            }
        }

        private boolean groupAndValueMatches(long groupId, Block block, int position, int nodePointer, int valuePosition)
        {
            long existingGroupId = groupIds.get(nodePointer);

            try {
                return existingGroupId == groupId && type.equalTo(block, position, values, valuePosition);
            }
            catch (NotSupportedException e) {
                throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);
            }
        }

        private ValueNode createValueNode(int nodePointer)
        {
            return new ValueNode(nodePointer);
        }
    }

    private interface NodeReader
    {
        void read(int nodePointer);
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Cast or transform the histogram key to a type with supported equality (e.g. CAST row/map to VARCHAR via json_format).
  2. Use only primitive key types (bigint, varchar, double) for histogram.
  3. Upgrade Presto if the type's equality support was added in a newer release.

Example fix

// before
SELECT histogram(row_col) FROM t;
// after
SELECT histogram(json_format(CAST(row_col AS JSON))) FROM t;
Defensive patterns

Strategy: type-guard

Validate before calling

-- restrict histogram keys to equality-supporting primitive types
SELECT typeof(key) FROM t LIMIT 1; -- should be bigint/varchar/double/boolean/date, not row/map/array

Type guard

boolean supportsHistogramKey(Type t) { return t.getJavaType() == long.class || t.getJavaType() == double.class || t.getJavaType() == boolean.class || t.getJavaType() == Slice.class; }

Try / catch

try { result = query(...); } catch (PrestoException e) { if (e.getErrorCode().getName().equals("NOT_SUPPORTED")) { /* cast key to VARCHAR/JSON and retry */ } else { throw e; } }

Prevention

When it happens

Trigger: Calling histogram (via createBucketDataNode → groupAndValueMatches) over a key type whose equality operator is unimplemented for the compared values — e.g. complex/nested types lacking a full equalTo implementation.

Common situations: Histogramming map/row or other complex-typed columns whose equality is not supported; types whose comparison support changed between Presto versions.

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/90eb37b4384eeea7. Report an issue: GitHub.