{"record":{"id":"d1bc772e49b64743","repo":"apache/shardingsphere","slug":"islast-d1bc77","errorCode":null,"errorMessage":"isLast","messagePattern":"isLast","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"warning","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java","lineNumber":55,"sourceCode":"    \n    @Override\n    public boolean isBeforeFirst() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"isBeforeFirst\");\n    }\n    \n    @Override\n    public boolean isAfterLast() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"isAfterLast\");\n    }\n    \n    @Override\n    public boolean isFirst() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"isFirst\");\n    }\n    \n    @Override\n    public boolean isLast() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"isLast\");\n    }\n    \n    @Override\n    public void beforeFirst() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"beforeFirst\");\n    }\n    \n    @Override\n    public void afterLast() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"afterLast\");\n    }\n    \n    @Override\n    public boolean first() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"first\");\n    }\n    \n    @Override","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java#L37-L73","documentation":"The federation result set deliberately does not implement cursor-positioning methods; isLast() throws SQLFeatureNotSupportedException with the method name. AbstractUnsupportedOperationSQLFederationResultSet marks JDBC capabilities that the Calcite-backed federation result set does not support, so drivers or code that probe isLast() fail loudly instead of getting wrong answers.","triggerScenarios":"Application or ORM code calls ResultSet.isLast() on a result set produced by a federated query (federation enabled and the query executed through SQLFederationExecutor).","commonSituations":"OR frameworks and reporting tools that call isLast() for pagination/iteration logic; custom JDBC wrappers that always probe result-set capabilities; code migrated from non-federated paths where the underlying driver supported isLast().","solutions":["Avoid isLast() on ShardingSphere result sets; track row positions yourself while iterating with next().","If the row count is needed, execute a COUNT query or fetch all rows into a list first.","Disable federation for the query so a driver result set with full capabilities is returned.","Configure ORMs to limit/offset via SQL rather than result-set positioning."],"exampleFix":"// before\nwhile (rs.next()) { if (rs.isLast()) { ... } }\n// after\nList<Row> rows = fetchAll(rs);  // iterate rs.next() and collect\nif (!rows.isEmpty()) { handleLast(rows.get(rows.size() - 1)); }","handlingStrategy":"validation","validationCode":"if (rs.getType() == ResultSet.TYPE_FORWARD_ONLY) {\n    // do not call isLast()/isFirst(); count rows while iterating\n}","typeGuard":null,"tryCatchPattern":"try {\n    boolean last = rs.isLast();\n} catch (final SQLFeatureNotSupportedException ex) {\n    // fall back to manual row tracking\n}","preventionTips":["Never call isLast()/isFirst()/isAfterLast() on proxy result sets.","Maintain row counters in application code during iteration.","Configure ORMs to avoid result-set capability probing."],"tags":["sql-federation","jdbc","resultset","unsupported-operation"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}