prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Unsupported type: ${type}

What it means

In SqlToRowExpressionTranslator.visitEnumLiteral, the type name attached to an enum literal cannot be resolved by the functionAndTypeResolver. When getType(parseTypeSignature(...)) throws IllegalArgumentException, the translator converts it into NOT_SUPPORTED because the enum literal references a type the engine does not know.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/relational/SqlToRowExpressionTranslator.java:429

        {
            return constant(node.getSlice(), createCharType(node.getValue().length()));
        }

        @Override
        protected RowExpression visitBinaryLiteral(BinaryLiteral node, Context context)
        {
            return constant(node.getValue(), VARBINARY);
        }

        @Override
        protected RowExpression visitEnumLiteral(EnumLiteral node, Context context)
        {
            Type type;
            try {
                type = functionAndTypeResolver.getType(parseTypeSignature(node.getType()));
            }
            catch (IllegalArgumentException e) {
                throw new PrestoException(NOT_SUPPORTED, "Unsupported type: " + node.getType());
            }

            return constant(node.getValue(), type);
        }

        @Override
        protected RowExpression visitGenericLiteral(GenericLiteral node, Context context)
        {
            Type type;
            try {
                type = functionAndTypeResolver.getType(parseTypeSignature(node.getType()));
            }
            catch (IllegalArgumentException e) {
                throw new PrestoException(NOT_SUPPORTED, "Unsupported type: " + node.getType());
            }

            try {
                if (TINYINT.equals(type)) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Correct the type name in the literal so it matches a registered type.
  2. Ensure the session/catalog providing the custom type is set so the type resolver can find it.
  3. Check release notes: if the type was renamed/removed in a Presto upgrade, migrate the literal to the new type.
  4. If the connector should supply the type, verify the connector plugin is installed and loaded.

Example fix

// before
SELECT CAST('A' AS MyEnum)  -- unknown type
// after
SELECT CAST('A' AS varchar)  -- or use the correctly registered enum type name
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the enum literal's type resolves before running
try {
    metadata.getType(typeName);
} catch (IllegalArgumentException e) {
    throw new QueryValidationException("Unknown type in enum literal: " + typeName);
}

Try / catch

try {
    session.execute(query);
} catch (PrestoException e) {
    if (e.getErrorCode().getCode() == StandardErrorCode.NOT_SUPPORTED.getCode() && e.getMessage().startsWith("Unsupported type:")) {
        // fix type name or fall back to a supported type
    } else throw e;
}

Prevention

When it happens

Trigger: Translating a SQL enum literal (e.g. `CAST(x AS my_catalog.my_type)` style typed literal or enum literal syntax) whose declared type string is not a registered type in the current type resolver context.

Common situations: Typo in the type name; using a connector-specific type without the connector catalog in scope; queries referencing types removed/renamed in a Presto upgrade.

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/12dcc60025453a94. Report an issue: GitHub.