prestodb/presto · error · SQLFeatureNotSupportedException

getUnicodeStream

Error message

getUnicodeStream

What it means

getUnicodeStream in PrestoResultSet always throws SQLFeatureNotSupportedException: the deprecated JDBC Unicode character stream retrieval API is not implemented by the Presto driver, regardless of the column index requested.

Source

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

                throw new SQLException("Invalid timestamp from server: " + value, e);
            }
        }

        throw new IllegalArgumentException("Expected column to be a timestamp type but is " + columnInfo.getColumnTypeName());
    }

    @Override
    public InputStream getAsciiStream(int columnIndex)
            throws SQLException
    {
        throw new NotImplementedException("ResultSet", "getAsciiStream");
    }

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

    @Override
    public InputStream getBinaryStream(int columnIndex)
            throws SQLException
    {
        throw new NotImplementedException("ResultSet", "getBinaryStream");
    }

    @Override
    public String getString(String columnLabel)
            throws SQLException
    {
        Object value = column(columnLabel);
        return (value != null) ? value.toString() : null;
    }

    @Override

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Replace with rs.getString(columnIndex), which returns decoded UTF-8 text
  2. If a stream is required, wrap the String bytes: new ByteArrayInputStream(rs.getString(i).getBytes(StandardCharsets.UTF_8))
  3. Retire the deprecated call site; the method is feature-unsupported by design

Example fix

// before
Reader r = new InputStreamReader(rs.getUnicodeStream(1), StandardCharsets.UTF_8);
// after
String s = rs.getString(1);
Reader r = s != null ? new StringReader(s) : null;
Defensive patterns

Strategy: try-catch

Try / catch

Reader r;
try {
    r = new InputStreamReader(rs.getUnicodeStream(idx), StandardCharsets.UTF_8);
} catch (SQLFeatureNotSupportedException e) {
    String s = rs.getString(idx);
    r = s != null ? new StringReader(s) : null;
}

Prevention

When it happens

Trigger: Calling rs.getUnicodeStream(columnIndex) on any PrestoResultSet, with any column index, at any time.

Common situations: Legacy JDBC code migrated from old databases that used getUnicodeStream; generated code or wrappers still emitting the deprecated stream getters.

Related errors


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