apache/shardingsphere · error · SQLFeatureNotSupportedException
absolute
Error message
absolute
What it means
absolute(int row) is unimplemented in the federation ResultSet: AbstractUnsupportedOperationSQLFederationResultSet throws SQLFeatureNotSupportedException for all absolute positioning because the underlying federation result is a one-pass stream. Unlike drivers that emulate absolute() by repeated next(), no emulation exists here.
Source
Thrown at kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java:80
@Override
public void afterLast() throws SQLException {
throw new SQLFeatureNotSupportedException("afterLast");
}
@Override
public boolean first() throws SQLException {
throw new SQLFeatureNotSupportedException("first");
}
@Override
public boolean last() throws SQLException {
throw new SQLFeatureNotSupportedException("last");
}
@Override
public boolean absolute(final int row) throws SQLException {
throw new SQLFeatureNotSupportedException("absolute");
}
@Override
public boolean relative(final int rows) throws SQLException {
throw new SQLFeatureNotSupportedException("relative");
}
@Override
public int getRow() throws SQLException {
throw new SQLFeatureNotSupportedException("getRow");
}
@Override
public final void insertRow() throws SQLException {
throw new SQLFeatureNotSupportedException("insertRow");
}
@OverrideView on GitHub (pinned to e952770a21)
Solutions
- Push pagination into SQL: append LIMIT/OFFSET (MySQL/PostgreSQL/OpenGauss dialects) to the federated query instead of absolute() positioning
- Compute the target row while iterating forward with next() and a row counter if the offset is small
- For random access, materialize rows into a List and index it in application code
Example fix
// before
rs.absolute(41); // jump to row 41
// after
ResultSet rs = stmt.executeQuery("SELECT ... ORDER BY id LIMIT 20 OFFSET 40");
rs.next(); Defensive patterns
Strategy: validation
Validate before calling
if (rs.getType() == ResultSet.TYPE_FORWARD_ONLY) {
// absolute(n) unsupported: use SQL OFFSET/LIMIT pagination
} Type guard
private boolean supportsAbsolute(final ResultSet rs) throws SQLException {
return rs.getType() != ResultSet.TYPE_FORWARD_ONLY;
} Try / catch
try {
rs.absolute(offset + 1);
} catch (final SQLFeatureNotSupportedException e) {
throw new IllegalStateException("use LIMIT/OFFSET pagination for federation result sets", e);
} Prevention
- Push pagination into SQL (LIMIT/OFFSET) instead of cursor jumping
- Audit for rs.absolute in pagination helpers before federation rollout
- Counter-based forward loops for small skips
When it happens
Trigger: Calling rs.absolute(n) on the result of a federated SELECT — most often hard-coded pagination (rs.absolute(pageSize*(page-1)+1)) or jumping to a known row index in report rendering code.
Common situations: Hand-rolled LIMIT/OFFSET pagination implemented via absolute(); DBUtils/DataTable components that position by row index; moving an existing application behind ShardingSphere federation without auditing ResultSet scrolling usage.
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/b61f3d42b9247d5a.
Report an issue: GitHub.