This is an automated email from the ASF dual-hosted git repository.

zihanli58 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gobblin.git


The following commit(s) were added to refs/heads/master by this push:
     new a7df7ca  [GOBBLIN-1581] Iterate over Sql ResultSet in Only the Forward 
Direction (#3435)
a7df7ca is described below

commit a7df7ca45d5281d2a0b831fb305fb0131aa4adac
Author: umustafi <[email protected]>
AuthorDate: Mon Nov 29 16:56:58 2021 -0800

    [GOBBLIN-1581] Iterate over Sql ResultSet in Only the Forward Direction 
(#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 <[email protected]>
---
 .../java/org/apache/gobblin/writer/commands/MySqlWriterCommands.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/MySqlWriterCommands.java
 
b/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/MySqlWriterCommands.java
index 5c4da5a..01264e0 100644
--- 
a/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/MySqlWriterCommands.java
+++ 
b/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/MySqlWriterCommands.java
@@ -82,7 +82,7 @@ public class MySqlWriterCommands implements 
JdbcWriterCommands {
   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);

Reply via email to