{"record":{"id":"cf6e914fce1f7671","repo":"prestodb/presto","slug":"isfirst","errorCode":null,"errorMessage":"isFirst","messagePattern":"isFirst","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":629,"sourceCode":"    @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()\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"beforeFirst\");\n    }\n\n    @Override\n    public void afterLast()","sourceCodeStart":611,"sourceCodeEnd":647,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L611-L647","documentation":"isFirst cannot be answered by the Presto driver because its result sets are forward-only streams with no absolute row positioning; PrestoResultSet throws SQLFeatureNotSupportedException unconditionally. The capability simply does not exist in this driver.","triggerScenarios":"Calling rs.isFirst() on a PrestoResultSet, often in row-number-sensitive processing logic.","commonSituations":"Rendering code that special-cases the first row; frameworks migrated from scrollable result-set drivers.","solutions":["Use a boolean/counter flag set when the first rs.next() succeeds","If first/last distinctions matter, materialize the rows into a List first","Never rely on cursor-position APIs against Presto result sets"],"exampleFix":"// before\nwhile (rs.next()) { if (rs.isFirst()) renderHeader(); renderRow(rs); }\n// after\nboolean first = true;\nwhile (rs.next()) { if (first) { renderHeader(); first = false; } renderRow(rs); }","handlingStrategy":"try-catch","validationCode":"if (rs instanceof com.facebook.presto.jdbc.PrestoResultSet) {\n    // maintain a first-row flag yourself\n}","typeGuard":"boolean isPrestoResultSet(ResultSet rs) { return rs instanceof com.facebook.presto.jdbc.PrestoResultSet; }","tryCatchPattern":"try {\n    boolean first = rs.isFirst();\n} catch (SQLFeatureNotSupportedException e) {\n    // maintain your own row counter/flag\n}","preventionTips":["Use boolean flags or row counters instead of position queries","Materialize rows into a List when positional logic is unavoidable"],"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"}