prestodb/presto · error · SQLException
Fetch size must be positive
Error message
Fetch size must be positive
What it means
setFetchSize in PrestoStatement rejects negative values with this SQLException: a fetch size must be zero (driver default) or a positive row count. It is a pure input validation guard before storing the value in fetchSize.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoStatement.java:390
}
// ignore: fetch direction is always forward
}
@Override
public int getFetchDirection()
throws SQLException
{
checkOpen();
return ResultSet.FETCH_FORWARD;
}
@Override
public void setFetchSize(int rows)
throws SQLException
{
checkOpen();
if (rows < 0) {
throw new SQLException("Fetch size must be positive");
}
fetchSize.set(rows);
}
@Override
public int getFetchSize()
throws SQLException
{
checkOpen();
return fetchSize.get();
}
@Override
public int getResultSetConcurrency()
throws SQLException
{
checkOpen();
return ResultSet.CONCUR_READ_ONLY;View on GitHub (pinned to 55bb57d202)
Solutions
- Pass 0 to use the driver default or a positive integer for the fetch size
- Validate configured fetch-size settings before applying them to statements
- Catch SQLException when fetch size originates from external configuration
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoStatement.java:390 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/9973085ecf76e80f.
Report an issue: GitHub.