{"record":{"id":"90eb37b4384eeea7","repo":"prestodb/presto","slug":"not-supported-90eb37","errorCode":"NOT_SUPPORTED","errorMessage":"%s","messagePattern":"%s","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/histogram/GroupedTypedHistogram.java","lineNumber":509,"sourceCode":"                }\n                else {\n                    // keep looking\n                    int probe = nextProbe(probeCount);\n                    bucketId = nextBucketId(originalBucketId, mask, probe);\n                    probeCount++;\n                }\n            }\n        }\n\n        private boolean groupAndValueMatches(long groupId, Block block, int position, int nodePointer, int valuePosition)\n        {\n            long existingGroupId = groupIds.get(nodePointer);\n\n            try {\n                return existingGroupId == groupId && type.equalTo(block, position, values, valuePosition);\n            }\n            catch (NotSupportedException e) {\n                throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);\n            }\n        }\n\n        private ValueNode createValueNode(int nodePointer)\n        {\n            return new ValueNode(nodePointer);\n        }\n    }\n\n    private interface NodeReader\n    {\n        void read(int nodePointer);\n    }\n}\n","sourceCodeStart":491,"sourceCodeEnd":524,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/histogram/GroupedTypedHistogram.java#L491-L524","documentation":"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.","triggerScenarios":"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.","commonSituations":"Histogramming map/row or other complex-typed columns whose equality is not supported; types whose comparison support changed between Presto versions.","solutions":["Cast or transform the histogram key to a type with supported equality (e.g. CAST row/map to VARCHAR via json_format).","Use only primitive key types (bigint, varchar, double) for histogram.","Upgrade Presto if the type's equality support was added in a newer release."],"exampleFix":"// before\nSELECT histogram(row_col) FROM t;\n// after\nSELECT histogram(json_format(CAST(row_col AS JSON))) FROM t;","handlingStrategy":"type-guard","validationCode":"-- restrict histogram keys to equality-supporting primitive types\nSELECT typeof(key) FROM t LIMIT 1; -- should be bigint/varchar/double/boolean/date, not row/map/array","typeGuard":"boolean supportsHistogramKey(Type t) { return t.getJavaType() == long.class || t.getJavaType() == double.class || t.getJavaType() == boolean.class || t.getJavaType() == Slice.class; }","tryCatchPattern":"try { result = query(...); } catch (PrestoException e) { if (e.getErrorCode().getName().equals(\"NOT_SUPPORTED\")) { /* cast key to VARCHAR/JSON and retry */ } else { throw e; } }","preventionTips":["Use only primitive key types with histogram","Check the type's equality support before new usage","Pin a single Presto version across the cluster"],"tags":["presto","histogram","not-supported","type-system"],"backgroundTag":"operation-not-supported-for-type","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}