prestodb/presto · error · SQLFeatureNotSupportedException
getObject
Error message
getObject
What it means
getObject(int, Map<String, Class<?>>) allows custom type mapping of SQL structured/distinct types. Presto does not support custom type maps, so this overload unconditionally throws SQLFeatureNotSupportedException("getObject"). Note the simple getObject(int) / getObject(String) overloads ARE supported.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:1095
@Override
public void moveToCurrentRow()
throws SQLException
{
throw new SQLFeatureNotSupportedException("moveToCurrentRow");
}
@Override
public Statement getStatement()
{
return statement;
}
@Override
public Object getObject(int columnIndex, Map<String, Class<?>> map)
throws SQLException
{
throw new SQLFeatureNotSupportedException("getObject");
}
@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)View on GitHub (pinned to 55bb57d202)
Solutions
- Use the plain getObject(int) or getObject(String, Class<T>) overload instead and cast/coerce in Java
- Pass an empty/default type map path: call getObject(columnIndex) and convert manually
- Centralize type conversion in a utility rather than relying on JDBC type maps
Example fix
// before
Object v = rs.getObject(3, conn.getTypeMap());
// after
Object v = rs.getObject(3);
BigDecimal d = (v instanceof BigDecimal)
? (BigDecimal) v
: new BigDecimal(v.toString()); Defensive patterns
Strategy: fallback
Validate before calling
// avoid the type-map overload; use the supported overload directly Object v = rs.getObject(columnIndex);
Try / catch
try {
return rs.getObject(i, typeMap);
} catch (SQLFeatureNotSupportedException e) {
return convert(rs.getObject(i), targetType); // manual conversion
} Prevention
- Use getObject(int) or getObject(String, Class<T>) overloads
- Do not pass Connection.getTypeMap() to Presto result sets
- Centralize SQL-to-Java type conversion in application code
When it happens
Trigger: Calling rs.getObject(col, typeMap) or rs.getObject(colName, typeMap) on a PrestoResultSet, usually to map structured types or force a specific Java class.
Common situations: Generic JDBC code that passes a Connection.getTypeMap() to every getObject call; code ported from Oracle/DB2 drivers that use structured types; frameworks using the map overload unconditionally.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/9c92e6c7be5900af.
Report an issue: GitHub.