{"record":{"id":"cfe53dba7dd7112f","repo":"apache/shardingsphere","slug":"relative-cfe53d","errorCode":null,"errorMessage":"relative","messagePattern":"relative","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java","lineNumber":85,"sourceCode":"    \n    @Override\n    public boolean first() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"first\");\n    }\n    \n    @Override\n    public boolean last() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"last\");\n    }\n    \n    @Override\n    public boolean absolute(final int row) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"absolute\");\n    }\n    \n    @Override\n    public boolean relative(final int rows) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"relative\");\n    }\n    \n    @Override\n    public int getRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getRow\");\n    }\n    \n    @Override\n    public final void insertRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"insertRow\");\n    }\n    \n    @Override\n    public final void updateRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateRow\");\n    }\n    \n    @Override","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java#L67-L103","documentation":"relative(int rows) — moving the cursor a relative number of rows — is not supported by the SQL Federation ResultSet and always throws SQLFeatureNotSupportedException. The class whitelists only forward streaming methods; every relative/absolute scroll operation is rejected.","triggerScenarios":"Calling rs.relative(n) or rs.relative(-n) on a federated ResultSet, e.g. skip-ahead loops (relative(5)) or step-back loops written for scrollable cursors, executed against ShardingSphere with sql-federation enabled.","commonSituations":"Batch-processing code that skips N rows at a time; ported desktop-report tooling; ORM plugins that use relative() for windowed reads. Appears when such code runs against a federation-routed statement (cross-shard join,联邦查询) rather than a native driver connection.","solutions":["Replace skip loops with SQL-level OFFSET/LIMIT windows","Emulate forward skips with a counted next() loop (for (int i=0;i<n && rs.next();i++))","Materialize the result set client-side if bidirectional relative movement is a hard requirement"],"exampleFix":"// before\nrs.relative(10); // skip 10 rows\n\n// after\nfor (int i = 0; i < 10 && rs.next(); i++) { /* skip */ }","handlingStrategy":"validation","validationCode":"if (rs.getType() == ResultSet.TYPE_FORWARD_ONLY) {\n    // relative(n) unsupported: emulate with a counted next() loop\n}","typeGuard":"private boolean supportsRelative(final ResultSet rs) throws SQLException {\n    return rs.getType() != ResultSet.TYPE_FORWARD_ONLY;\n}","tryCatchPattern":"try {\n    rs.relative(skip);\n} catch (final SQLFeatureNotSupportedException e) {\n    for (int i = 0; i < skip && rs.next(); i++) { /* skip forward */ }\n}","preventionTips":["Avoid relative() in batch/skip loops; use OFFSET windows","Treat any negative relative() as a design smell on federated reads","Encapsulate skipping in one utility that knows the cursor type"],"tags":["jdbc","resultset","sql-federation","cursor","shardingsphere"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}