Skip to content

Commit

Permalink
[GOBBLIN-1581] Iterate over Sql ResultSet in Only the Forward Directi…
Browse files Browse the repository at this point in the history
…on (#3435)

* after sql-connector was bumped, exception results from ResultSet.first() being called because it iterates in backward direction of set

Co-authored-by: Urmi Mustafi <umustafi@umustafi-mn1.linkedin.biz>
  • Loading branch information
umustafi and Urmi Mustafi committed Nov 30, 2021
1 parent 89497c6 commit a7df7ca
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void createTableStructure(String databaseName, String fromStructure, Stri
public boolean isEmpty(String database, String table) throws SQLException {
String sql = String.format(SELECT_SQL_FORMAT, database, table);
try (PreparedStatement pstmt = this.conn.prepareStatement(sql); ResultSet resultSet = pstmt.executeQuery();) {
if (!resultSet.first()) {
if (!resultSet.next()) {
throw new RuntimeException("Should have received at least one row from SQL " + pstmt);
}
return 0 == resultSet.getInt(1);
Expand Down

0 comments on commit a7df7ca

Please sign in to comment.