prestodb/presto · error · SQLFeatureNotSupportedException

getClob

Error message

getClob

What it means

Presto's JDBC driver does not implement Clob support. PrestoResultSet.getClob(int) unconditionally throws SQLFeatureNotSupportedException("getClob"). Presto returns all values via the standard getString/getObject-style accessors; LOCATOR-based SQL types (CLOB/BLOB/REF/Array-as-SQL) are not part of the protocol.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:1116

    @Override
    public Ref getRef(int columnIndex)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("getRef");
    }

    @Override
    public Blob getBlob(int columnIndex)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("getBlob");
    }

    @Override
    public Clob getClob(int columnIndex)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("getClob");
    }

    @Override
    public Array getArray(int columnIndex)
            throws SQLException
    {
        Object value = column(columnIndex);
        if (value == null) {
            return null;
        }

        ColumnInfo columnInfo = columnInfo(columnIndex);
        String elementTypeName = getOnlyElement(columnInfo.getColumnTypeSignature().getParameters()).toString();
        int elementType = getOnlyElement(columnInfo.getColumnParameterTypes());
        return new PrestoArray(elementTypeName, elementType, (List<?>) value);
    }

    @Override

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Replace getClob with rs.getString(columnIndex) — Presto VARCHAR columns are fully readable as String
  2. If using an abstraction layer, configure its Clob/mapping handler to fall back to getString
  3. Check the column's actual type with ResultSetMetaData and branch accordingly

Example fix

// before
Clob clob = rs.getClob(1);
String text = clob.getSubString(1, (int) clob.length());
// after
String text = rs.getString(1);
Defensive patterns

Strategy: try-catch

Validate before calling

int type = rs.getMetaData().getColumnType(columnIndex);
if (type == Types.CLOB) { /* Presto driver never returns this; read as VARCHAR */ }

Try / catch

try {
    return rs.getClob(columnIndex);
} catch (SQLFeatureNotSupportedException e) {
    return rs.getString(columnIndex);
}

Prevention

When it happens

Trigger: Calling rs.getClob(columnIndex) on any PrestoResultSet, regardless of column type or result contents.

Common situations: Porting code written for Oracle/PostgreSQL/MySQL drivers that read large text columns via getClob; generic ORM or BI tool code paths that default to Clob for long VARCHAR columns.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/ae51d836df40f2ef. Report an issue: GitHub.