prestodb/presto · error · NotImplementedException

ResultSet

Error message

ResultSet

What it means

The legacy JDBC 1.0 getAsciiStream(int) method is not implemented in PrestoResultSet; it unconditionally throws NotImplementedException. The Presto JDBC driver never supports reading columns as ASCII streams.

Source

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

        }

        if (columnInfo.getColumnTypeName().equalsIgnoreCase("timestamp with time zone")) {
            try {
                return new Timestamp(TIMESTAMP_WITH_TIME_ZONE_FORMATTER.parseMillis(String.valueOf(value)));
            }
            catch (IllegalArgumentException e) {
                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)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Replace getAsciiStream with rs.getString(columnIndex)
  2. If a stream is needed, wrap the String: new ByteArrayInputStream(rs.getString(i).getBytes(StandardCharsets.US_ASCII))
  3. Remove or stub the legacy stream-based code path when targeting Presto

Example fix

// before
InputStream in = rs.getAsciiStream(1);
// after
String value = rs.getString(1);
InputStream in = value != null ? new ByteArrayInputStream(value.getBytes(StandardCharsets.US_ASCII)) : null;
Defensive patterns

Strategy: try-catch

Try / catch

InputStream in;
try {
    in = rs.getAsciiStream(idx);
} catch (NotImplementedException e) {
    String s = rs.getString(idx);
    in = s != null ? new ByteArrayInputStream(s.getBytes(StandardCharsets.US_ASCII)) : null;
}

Prevention

When it happens

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

Common situations: Porting generic JDBC code written for legacy drivers (e.g. old Oracle code) that reads text columns as streams; frameworks that fall back to stream-based getters.

Related errors


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