prestodb/presto · error · PrestoException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
e.getMessage()
What it means
The map subscript operator map[key] throws NOT_SUPPORTED when seekKeyExact raises NotSupportedException because the map's key type cannot be hashed/compared natively. This is the legacy (nullable-result) subscript overload.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/MapSubscriptOperator.java:122
return new BuiltInScalarFunctionImplementation(
true,
ImmutableList.of(
valueTypeArgumentProperty(RETURN_NULL_ON_NULL),
valueTypeArgumentProperty(RETURN_NULL_ON_NULL)),
methodHandle);
}
@UsedByGeneratedCode
public static Object subscript(boolean legacyMissingKey, MissingKeyExceptionFactory missingKeyExceptionFactory, MethodHandle keyNativeHashCode, MethodHandle keyBlockNativeEquals, MethodHandle keyBlockHashCode, Type valueType, SqlFunctionProperties properties, Block map, boolean key)
{
SingleMapBlock mapBlock = (SingleMapBlock) map;
int valuePosition;
try {
valuePosition = mapBlock.seekKeyExact(key, keyNativeHashCode, keyBlockNativeEquals, keyBlockHashCode);
}
catch (NotSupportedException e) {
throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);
}
if (valuePosition == -1) {
if (legacyMissingKey) {
return null;
}
throw missingKeyExceptionFactory.create(properties, key);
}
return readNativeValue(valueType, mapBlock, valuePosition);
}
@UsedByGeneratedCode
public static Object subscript(boolean legacyMissingKey, MissingKeyExceptionFactory missingKeyExceptionFactory, MethodHandle keyNativeHashCode, MethodHandle keyBlockNativeEquals, MethodHandle keyBlockHashCode, Type valueType, SqlFunctionProperties properties, Block map, long key)
{
SingleMapBlock mapBlock = (SingleMapBlock) map;
int valuePosition;
try {
valuePosition = mapBlock.seekKeyExact(key, keyNativeHashCode, keyBlockNativeEquals, keyBlockHashCode);View on GitHub (pinned to 55bb57d202)
Solutions
- Use simple key types for maps.
- Restructure data so lookup keys are primitives.
- Cast keys to a supported type when constructing the map.
- Upgrade Presto if support for the key type exists in newer releases.
Example fix
// before SELECT m[ROW(1,'a')] FROM t; // after SELECT m['1|a'] FROM t; -- varchar key
Defensive patterns
Strategy: try-catch
Validate before calling
SELECT typeof(m) FROM t; -- confirm key type is supported before m[key]
Try / catch
try {
value = mapSubscript(map, key);
} catch (PrestoException e) {
if (e.getErrorCode().getName().equals("NOT_SUPPORTED")) {
value = null; // or scan entries
}
} Prevention
- Use primitive key types
- Encode complex keys as varchar
- Check legacy missing-key config expectations
When it happens
Trigger: Evaluating map[key] on a map whose key type is a complex type unsupported for native lookup; legacy_missing_key_behavior=true path.
Common situations: Row/array/map-typed keys produced by complex ETL; older configs relying on legacy missing-key behavior.
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/e1bf44995cf11333.
Report an issue: GitHub.