diff --git a/src/main/java/com/ververica/flink/table/jdbc/FlinkResultSet.java b/src/main/java/com/ververica/flink/table/jdbc/FlinkResultSet.java index b7e4d9e..8ef4eb1 100644 --- a/src/main/java/com/ververica/flink/table/jdbc/FlinkResultSet.java +++ b/src/main/java/com/ververica/flink/table/jdbc/FlinkResultSet.java @@ -114,7 +114,7 @@ public synchronized void close() throws SQLException { return; } - if (jobIdOrResultSet.isLeft()) { + if (jobIdOrResultSet.isLeft() && rowData.hasMoreResponse()) { // no need to lock, closing while fetching new results should throw exception session.cancelJob(jobIdOrResultSet.left()); } @@ -1395,6 +1395,10 @@ boolean isAfterLast() { return ret; } + boolean hasMoreResponse() { + return hasMoreResponse; + } + Row getCurrentRow() { lock.readLock().lock(); Row ret = currentRow;