prestodb/presto · error · SQLFeatureNotSupportedException

getRow

Error message

getRow

What it means

PrestoResultSet throws SQLFeatureNotSupportedException("getRow") because row positioning is meaningless in a forward-only streaming result set; the driver never tracks a 1-based absolute row number for the caller.

Source

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

    @Override
    public boolean first()
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("first");
    }

    @Override
    public boolean last()
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("last");
    }

    @Override
    public int getRow()
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("getRow");
    }

    @Override
    public boolean absolute(int row)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("absolute");
    }

    @Override
    public boolean relative(int rows)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("relative");
    }

    @Override
    public boolean previous()

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Maintain your own counter incremented in each rs.next() loop iteration
  2. Use SELECT COUNT(*) for total row counts instead of last()+getRow()
  3. Expose the row index from your own iteration wrapper class

Example fix

// before
while (rs.next()) { process(rs.getRow(), rs); }
// after
int row = 0;
while (rs.next()) { row++; process(row, rs); }
Defensive patterns

Strategy: try-catch

Validate before calling

// Track row number yourself before calling getRow()
int rowNum = 0;
while (rs.next()) { rowNum++; }

Try / catch

try { int n = rs.getRow(); } catch (SQLFeatureNotSupportedException e) { /* use own counter */ }

Prevention

When it happens

Trigger: Calling ResultSet.getRow() on a PrestoResultSet at any point during iteration.

Common situations: Progress reporting or pagination code that uses getRow() to track the current row number while fetching; row-count idiom rs.last(); rs.getRow().

Related errors


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