{"record":{"id":"cc0d97434f9a4745","repo":"prestodb/presto","slug":"isafterlast","errorCode":null,"errorMessage":"isAfterLast","messagePattern":"isAfterLast","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":622,"sourceCode":"    @Override\n    public BigDecimal getBigDecimal(String columnLabel)\n            throws SQLException\n    {\n        return getBigDecimal(columnIndex(columnLabel));\n    }\n\n    @Override\n    public boolean isBeforeFirst()\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"isBeforeFirst\");\n    }\n\n    @Override\n    public boolean isAfterLast()\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"isAfterLast\");\n    }\n\n    @Override\n    public boolean isFirst()\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"isFirst\");\n    }\n\n    @Override\n    public boolean isLast()\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"isLast\");\n    }\n\n    @Override\n    public void beforeFirst()","sourceCodeStart":604,"sourceCodeEnd":640,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L604-L640","documentation":"isAfterLast is a cursor-position query unsupported because PrestoResultSets are forward-only streams without tracked end-of-cursor state; the driver throws SQLFeatureNotSupportedException unconditionally. There is no scenario in which it returns a value.","triggerScenarios":"Calling rs.isAfterLast() on a PrestoResultSet, typically to detect that iteration consumed all rows.","commonSituations":"Porting scrollable-cursor logic from other JDBC drivers; loop guards written for MySQL/PostgreSQL result sets.","solutions":["Track exhaustion yourself via the return value of rs.next()","Buffer rows if post-iteration position checks are needed","Avoid any cursor-position introspection APIs (isFirst/isLast/isAfterLast/isBeforeFirst) with Presto"],"exampleFix":"// before\nwhile (rs.next()) {}\nif (rs.isAfterLast()) { /* done */ }\n// after\nboolean consumed = false;\nwhile (rs.next()) { consumed = true; processRow(rs); }\nif (consumed) { /* done */ }","handlingStrategy":"try-catch","validationCode":"if (rs instanceof com.facebook.presto.jdbc.PrestoResultSet) {\n    // track row consumption manually via rs.next() return values\n}","typeGuard":"boolean isPrestoResultSet(ResultSet rs) { return rs instanceof com.facebook.presto.jdbc.PrestoResultSet; }","tryCatchPattern":"try {\n    boolean done = rs.isAfterLast();\n} catch (SQLFeatureNotSupportedException e) {\n    // infer completion from rs.next() returning false\n}","preventionTips":["Replace isAfterLast checks with logic driven by rs.next() returning false","Avoid scrollable-cursor idioms when connecting to Presto"],"tags":["jdbc","presto","unsupported-operation","cursor-position"],"backgroundTag":"jdbc-feature-not-supported","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}