{"record":{"id":"235558b504619cc5","repo":"apache/shardingsphere","slug":"getrow-235558","errorCode":null,"errorMessage":"getRow","messagePattern":"getRow","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java","lineNumber":90,"sourceCode":"    \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\n    public final void deleteRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"deleteRow\");\n    }\n    \n    @Override","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java#L72-L108","documentation":"getRow() — returning the current row number — throws SQLFeatureNotSupportedException in the SQL Federation ResultSet. Because the cursor model is forward-only and the class also rejects absolute/last positioning, the row-index contract of getRow() is deliberately not implemented.","triggerScenarios":"Calling rs.getRow() while iterating a federated ResultSet, e.g. progress logging ('processing row ' + rs.getRow()), row-count via last()+getRow(), or conditional logic keyed on the current row index.","commonSituations":"Row counters inside iteration loops; pagination totals computed with last()/getRow(); code migrated from MySQL Connector/J where getRow() is cheap and supported. Surfaces only for statements routed through the SQL Federation engine (sql_federation_type=BASIC/ADVANCED and a federation-eligible query).","solutions":["Maintain an application-side row counter (int row = 1; ... row++) instead of getRow()","For totals, run a separate COUNT query rather than last()+getRow()","Audit code paths that run against federation-enabled datasources with grep for getRow/absolute/relative/first/last before migration"],"exampleFix":"// before\nwhile (rs.next()) { log(\"row {}\", rs.getRow()); }\n\n// after\nint row = 0;\nwhile (rs.next()) { row++; log(\"row {}\", row); }","handlingStrategy":"validation","validationCode":"boolean supportsGetRow;\ntry { rs.getRow(); supportsGetRow = true; }\ncatch (final SQLFeatureNotSupportedException e) { supportsGetRow = false; }","typeGuard":"private int safeRow(final ResultSet rs, final int fallbackRow) throws SQLException {\n    try { return rs.getRow(); }\n    catch (final SQLFeatureNotSupportedException e) { return fallbackRow; }\n}","tryCatchPattern":"int row;\ntry { row = rs.getRow(); }\ncatch (final SQLFeatureNotSupportedException e) { row = localRowCounter++; }","preventionTips":["Keep a local row counter in iteration loops","Never rely on getRow() for totals; use COUNT(*)","Add getRow to the federation incompatibility checklist"],"tags":["jdbc","resultset","sql-federation","row-count","shardingsphere"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}