{"record":{"id":"0a89d96d6c289de9","repo":"prestodb/presto","slug":"not-supported-0a89d9","errorCode":"NOT_SUPPORTED","errorMessage":"NOT_SUPPORTED (message from NotSupportedException)","messagePattern":"NOT_SUPPORTED \\(message from NotSupportedException\\)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/util/MergingPageIterator.java","lineNumber":142,"sourceCode":"        }\n\n        @Override\n        public int compareTo(PagePosition other)\n        {\n            for (int i = 0; i < sortFields.size(); i++) {\n                int channel = sortFields.get(i);\n                SortOrder order = sortOrders.get(i);\n                Type type = types.get(channel);\n\n                Block block = page.getBlock(channel);\n                Block otherBlock = other.page.getBlock(channel);\n\n                int result;\n                try {\n                    result = order.compareBlockValue(type, block, position, otherBlock, other.position);\n                }\n                catch (NotSupportedException e) {\n                    throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);\n                }\n\n                if (result != 0) {\n                    return result;\n                }\n            }\n            return 0;\n        }\n    }\n}\n","sourceCodeStart":124,"sourceCodeEnd":153,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/util/MergingPageIterator.java#L124-L153","documentation":"MergingPageIterator compares page positions to merge sorted inputs. When the underlying type's compareBlockValue does not support the comparison (NotSupportedException from the type operator layer), it is wrapped in a PrestoException with code NOT_SUPPORTED. The operation is valid syntactically but the type combination/ordering is unsupported by the engine.","triggerScenarios":"Merging/unioning pages with an ORDER BY key of a type whose comparison operator is not implemented (e.g. certain complex/nested types), hitting order.compareBlockValue in compareTo.","commonSituations":"Queries ordering or merging on map/array/row types that lack comparison operators; connector returning pages with unsortable key types; using ORDER BY/MERGE on unsupported types across versions.","solutions":["Cast/ordering keys to a comparable type (e.g. cast struct to varchar or order by individual fields)","Reformulate the query to avoid ORDER BY/merge on the unsupported type","Upgrade Presto — comparison support for more types is added over time","Ensure the connector does not emit unsupported key types for sorted merge"],"exampleFix":"// before\nSELECT * FROM t ORDER BY map_col;  -- NOT_SUPPORTED\n// after\nSELECT * FROM t ORDER BY CAST(map_col AS VARCHAR);","handlingStrategy":"validation","validationCode":"// verify the ordering key type supports comparison before merge\ntry {\n    type.getOperatorType(OperatorType.COMPARISON);\n} catch (Exception e) {\n    throw new PrestoException(NOT_SUPPORTED, \"Type not comparable: \" + type);\n}","typeGuard":"boolean isComparable(Type type) {\n    try {\n        type.getOperatorType(OperatorType.COMPARISON);\n        return true;\n    } catch (OperatorNotFoundException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    iterator = new MergingPageIterator(...);\n} catch (PrestoException e) {\n    if (NOT_SUPPORTED.toErrorCode().equals(e.getErrorCode())) {\n        LOG.warn(\"Non-comparable sort key: \" + e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Order/merge only on scalar comparable types (integers, strings, dates)","Avoid ORDER BY on map/array/row columns; order by their fields instead","Cast complex keys to a comparable type before merging","Pin Presto to a version known to support your sort key types"],"tags":["presto","ordering","not-supported","type-system"],"backgroundTag":"comparison-not-supported","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"}