prestodb/presto · error · PrestoException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
NOT_SUPPORTED (message from NotSupportedException)
What it means
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.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/util/MergingPageIterator.java:142
}
@Override
public int compareTo(PagePosition other)
{
for (int i = 0; i < sortFields.size(); i++) {
int channel = sortFields.get(i);
SortOrder order = sortOrders.get(i);
Type type = types.get(channel);
Block block = page.getBlock(channel);
Block otherBlock = other.page.getBlock(channel);
int result;
try {
result = order.compareBlockValue(type, block, position, otherBlock, other.position);
}
catch (NotSupportedException e) {
throw new PrestoException(NOT_SUPPORTED, e.getMessage(), e);
}
if (result != 0) {
return result;
}
}
return 0;
}
}
}
View on GitHub (pinned to 55bb57d202)
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
Example fix
// before SELECT * FROM t ORDER BY map_col; -- NOT_SUPPORTED // after SELECT * FROM t ORDER BY CAST(map_col AS VARCHAR);
Defensive patterns
Strategy: validation
Validate before calling
// verify the ordering key type supports comparison before merge
try {
type.getOperatorType(OperatorType.COMPARISON);
} catch (Exception e) {
throw new PrestoException(NOT_SUPPORTED, "Type not comparable: " + type);
} Type guard
boolean isComparable(Type type) {
try {
type.getOperatorType(OperatorType.COMPARISON);
return true;
} catch (OperatorNotFoundException e) {
return false;
}
} Try / catch
try {
iterator = new MergingPageIterator(...);
} catch (PrestoException e) {
if (NOT_SUPPORTED.toErrorCode().equals(e.getErrorCode())) {
LOG.warn("Non-comparable sort key: " + e.getMessage());
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
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/0a89d96d6c289de9.
Report an issue: GitHub.