prestodb/presto · error · IllegalArgumentException

Unsupported type for

Error message

Unsupported type for %s

What it means

getHashCode computes an identity hash for reference-counted cache keys from Block, Slice, array, or HashTables types; this throw is the terminal branch for any other key class passed to ReferenceCountMap, i.e. an unsupported key type.

Solutions

  1. Ensure only supported key kinds (Block, Slice, arrays) are placed in the reference-count map
  2. Add a branch for the new key type if a new abstraction is introduced
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at presto-common/src/main/java/com/facebook/presto/common/array/ReferenceCountMap.java:97 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at presto-common/src/main/java/com/facebook/presto/common/array/ReferenceCountMap.java:97

        // The collision rate can be lower than 0.001% if there are 1000 different sizes.
        int extraIdentity;
        if (key == null) {
            extraIdentity = 0;
        }
        else if (key instanceof Block) {
            extraIdentity = (int) ((Block) key).getRetainedSizeInBytes();
        }
        else if (key instanceof Slice) {
            extraIdentity = (int) ((Slice) key).getRetainedSize();
        }
        else if (key.getClass().isArray()) {
            extraIdentity = getLength(key);
        }
        else if (key instanceof AbstractMapBlock.HashTables) {
            extraIdentity = (int) ((AbstractMapBlock.HashTables) key).getRetainedSizeInBytes();
        }
        else {
            throw new IllegalArgumentException(format("Unsupported type for %s", key));
        }
        return (((long) System.identityHashCode(key)) << Integer.SIZE) + extraIdentity;
    }
}

View on GitHub (pinned to 55bb57d202)