{"record":{"id":"d8a559501ad498ca","repo":"apache/shardingsphere","slug":"getrow","errorCode":null,"errorMessage":"getRow","messagePattern":"getRow","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java","lineNumber":90,"sourceCode":"    \n    @Override\n    public final boolean last() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"last\");\n    }\n    \n    @Override\n    public final boolean absolute(final int row) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"absolute\");\n    }\n    \n    @Override\n    public final boolean relative(final int rows) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"relative\");\n    }\n    \n    @Override\n    public final 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/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java#L72-L108","documentation":"getRow() returns the current row number (1-based), but ShardingSphere's AbstractUnsupportedOperationResultSet makes it final and throwing because forward-only merge results do not maintain a row counter for position queries. Callers see SQLFeatureNotSupportedException instead of a number.","triggerScenarios":"Calling rs.getRow() during iteration — typically for progress logging or as the rs.last()+getRow() row-count idiom — on any ShardingSphere-driver query.","commonSituations":"Progress counters in batch processors; row-count tricks ported from scrollable cursors; frameworks that tag rows with their ordinal via getRow().","solutions":["Maintain your own counter incremented with every successful rs.next().","For total counts, execute SELECT COUNT(*) separately.","If ordinals are needed after iteration, store rows in an indexed List.","For displaying progress on huge merges, log per N iterations of your own counter."],"exampleFix":"// before\nwhile (rs.next()) { log.info(\"row {}\", rs.getRow()); } // throws\n\n// after\nint row = 0;\nwhile (rs.next()) { row++; log.info(\"row {}\", row); }","handlingStrategy":"validation","validationCode":"if (rs.getType() == ResultSet.TYPE_FORWARD_ONLY) {\n    int row = 0;\n    while (rs.next()) { row++; } // maintain your own row number\n}","typeGuard":null,"tryCatchPattern":"try {\n    int n = rs.getRow();\n} catch (SQLFeatureNotSupportedException e) {\n    // use the local counter incremented alongside next()\n}","preventionTips":["Pair every iteration with a local row counter instead of getRow().","Use COUNT(*) for totals; never the last()+getRow() idiom on sharded results.","Keep position logic in your code, not in ResultSet probes."],"tags":["jdbc","resultset","row-number","forward-only","counter"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}