{"record":{"id":"e1bf44995cf11333","repo":"prestodb/presto","slug":"not-supported-e1bf44","errorCode":"NOT_SUPPORTED","errorMessage":"e.getMessage()","messagePattern":"e\\.getMessage\\(\\)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/scalar/MapSubscriptOperator.java","lineNumber":122,"sourceCode":"\n        return new BuiltInScalarFunctionImplementation(\n                true,\n                ImmutableList.of(\n                        valueTypeArgumentProperty(RETURN_NULL_ON_NULL),\n                        valueTypeArgumentProperty(RETURN_NULL_ON_NULL)),\n                methodHandle);\n    }\n\n    @UsedByGeneratedCode\n    public static Object subscript(boolean legacyMissingKey, MissingKeyExceptionFactory missingKeyExceptionFactory, MethodHandle keyNativeHashCode, MethodHandle keyBlockNativeEquals, MethodHandle keyBlockHashCode, Type valueType, SqlFunctionProperties properties, Block map, boolean key)\n    {\n        SingleMapBlock mapBlock = (SingleMapBlock) map;\n        int valuePosition;\n        try {\n            valuePosition = mapBlock.seekKeyExact(key, keyNativeHashCode, keyBlockNativeEquals, keyBlockHashCode);\n        }\n        catch (NotSupportedException e) {\n            throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);\n        }\n\n        if (valuePosition == -1) {\n            if (legacyMissingKey) {\n                return null;\n            }\n            throw missingKeyExceptionFactory.create(properties, key);\n        }\n        return readNativeValue(valueType, mapBlock, valuePosition);\n    }\n\n    @UsedByGeneratedCode\n    public static Object subscript(boolean legacyMissingKey, MissingKeyExceptionFactory missingKeyExceptionFactory, MethodHandle keyNativeHashCode, MethodHandle keyBlockNativeEquals, MethodHandle keyBlockHashCode, Type valueType, SqlFunctionProperties properties, Block map, long key)\n    {\n        SingleMapBlock mapBlock = (SingleMapBlock) map;\n        int valuePosition;\n        try {\n            valuePosition = mapBlock.seekKeyExact(key, keyNativeHashCode, keyBlockNativeEquals, keyBlockHashCode);","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/scalar/MapSubscriptOperator.java#L104-L140","documentation":"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.","triggerScenarios":"Evaluating map[key] on a map whose key type is a complex type unsupported for native lookup; legacy_missing_key_behavior=true path.","commonSituations":"Row/array/map-typed keys produced by complex ETL; older configs relying on legacy missing-key behavior.","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."],"exampleFix":"// before\nSELECT m[ROW(1,'a')] FROM t;\n// after\nSELECT m['1|a'] FROM t; -- varchar key","handlingStrategy":"try-catch","validationCode":"SELECT typeof(m) FROM t; -- confirm key type is supported before m[key]","typeGuard":null,"tryCatchPattern":"try {\n    value = mapSubscript(map, key);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"NOT_SUPPORTED\")) {\n        value = null; // or scan entries\n    }\n}","preventionTips":["Use primitive key types","Encode complex keys as varchar","Check legacy missing-key config expectations"],"tags":["presto","map","subscript","not-supported"],"backgroundTag":"unsupported-map-key-type","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}