prestodb/presto · error · SQLFeatureNotSupportedException

getURL

Error message

getURL

What it means

getURL(int) is not implemented: Presto's driver never materializes java.net.URL values, so it always throws SQLFeatureNotSupportedException("getURL"). Read the column as a String and construct a URL yourself.

Source

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

    @Override
    public Timestamp getTimestamp(int columnIndex, Calendar cal)
            throws SQLException
    {
        return getTimestamp(columnIndex, DateTimeZone.forTimeZone(cal.getTimeZone()));
    }

    @Override
    public Timestamp getTimestamp(String columnLabel, Calendar cal)
            throws SQLException
    {
        return getTimestamp(columnIndex(columnLabel), cal);
    }

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

    @Override
    public URL getURL(String columnLabel)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("getURL");
    }

    @Override
    public void updateRef(int columnIndex, Ref x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("updateRef");
    }

    @Override
    public void updateRef(String columnLabel, Ref x)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use rs.getString(columnIndex) and new URL(value) (or URI.create) yourself
  2. Guard for null/blank strings before parsing
  3. Drop DATALINK assumptions — Presto has no DATALINK type

Example fix

// before
URL url = rs.getURL(1);
// after
String s = rs.getString(1);
URL url = (s == null) ? null : new URL(s);
Defensive patterns

Strategy: try-catch

Validate before calling

int type = rs.getMetaData().getColumnType(columnIndex);
if (type == Types.DATALINK) { /* Presto never returns DATALINK */ }

Try / catch

try {
    return rs.getURL(columnIndex);
} catch (SQLFeatureNotSupportedException e) {
    String s = rs.getString(columnIndex);
    return s == null ? null : new java.net.URL(s);
}

Prevention

When it happens

Trigger: Calling rs.getURL(columnIndex) on any PrestoResultSet.

Common situations: Code that assumed DATALINK column support; ported getter code from drivers like Derby that support getURL.

Related errors


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