prestodb/presto · error · SQLFeatureNotSupportedException
updateBinaryStream
Error message
updateBinaryStream
What it means
PrestoResultSet.updateBinaryStream(int, InputStream, int) unconditionally throws SQLFeatureNotSupportedException("updateBinaryStream"). Presto result sets are read-only; this streaming-update method is a stub that satisfies the JDBC interface and immediately rejects use. Binary stream data cannot be written into a row via the cursor.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:879
@Override
public void updateTimestamp(int columnIndex, Timestamp x)
throws SQLException
{
throw new SQLFeatureNotSupportedException("updateTimestamp");
}
@Override
public void updateAsciiStream(int columnIndex, InputStream x, int length)
throws SQLException
{
throw new SQLFeatureNotSupportedException("updateAsciiStream");
}
@Override
public void updateBinaryStream(int columnIndex, InputStream x, int length)
throws SQLException
{
throw new SQLFeatureNotSupportedException("updateBinaryStream");
}
@Override
public void updateCharacterStream(int columnIndex, Reader x, int length)
throws SQLException
{
throw new SQLFeatureNotSupportedException("updateCharacterStream");
}
@Override
public void updateObject(int columnIndex, Object x, int scaleOrLength)
throws SQLException
{
throw new SQLFeatureNotSupportedException("updateObject");
}
@Override
public void updateObject(int columnIndex, Object x)View on GitHub (pinned to 55bb57d202)
Solutions
- Read the stream into a byte[] and execute a parameterized UPDATE with setBytes or setBinaryStream via the driver's parameter support.
- For large objects, stage data externally (object store/Hive table) and reference or INSERT it with SQL rather than cursor updates.
- Use CONCUR_READ_ONLY result sets and remove cursor-update assumptions.
- Mark the datasource read-only in the data-access layer.
Example fix
// before
rs.updateBinaryStream("payload", in, length);
rs.updateRow();
// after
byte[] data = in.readAllBytes();
try (PreparedStatement ps = conn.prepareStatement("UPDATE blobs SET payload = ? WHERE id = ?")) {
ps.setBytes(1, data);
ps.setLong(2, id);
ps.executeUpdate();
} Defensive patterns
Strategy: try-catch
Validate before calling
if (rs instanceof com.facebook.presto.jdbc.PrestoResultSet) {
// Presto: read stream to byte[] and use UPDATE with setBytes
} Type guard
boolean supportsBinaryStreamUpdate(ResultSet rs) {
return !(rs instanceof com.facebook.presto.jdbc.PrestoResultSet);
} Try / catch
try {
rs.updateBinaryStream("payload", in, length);
rs.updateRow();
} catch (SQLFeatureNotSupportedException e) {
// byte[] data = in.readAllBytes(); execute UPDATE with setBytes
} Prevention
- Route binary writes through PreparedStatement.setBytes plus executeUpdate.
- Keep large objects in object storage; store references in Presto tables.
- Use CONCUR_READ_ONLY so cursor-update paths never execute.
- Verify third-party persistence layers do not use streaming result-set updates with Presto.
When it happens
Trigger: Calling updateBinaryStream(columnIndex, stream, length) (or label variant) on a PrestoResultSet when attempting to stream VARBINARY/blob-like data into a fetched row before updateRow().
Common situations: Binary-object pipelines ported from BLOB-capable JDBC drivers; media-processing jobs editing blobs in place; ORMs or persistence layers that stream large binaries through updatable result sets.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/e870491a9935cfe0.
Report an issue: GitHub.