pan3793 commented on code in PR #56341:
URL: https://github.com/apache/spark/pull/56341#discussion_r3361768878


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -164,35 +177,60 @@ class SparkConnectStatement(conn: SparkConnectConnection) 
extends Statement {
   override def getUpdateCount: Int = {
     checkOpen()
 
-    if (resultSet != null) {
+    if (resultsExhausted || resultSet != null) {
       -1
     } else {
       0 // always return 0 because affected rows is not supported yet
     }
   }
 
-  override def getMoreResults: Boolean =
-    throw new SQLFeatureNotSupportedException
+  // a single result per execute(), so there is no next one: close the current
+  // ResultSet and mark exhausted, flipping getUpdateCount() to -1 so drain 
loops end
+  override def getMoreResults: Boolean = {
+    checkOpen()
+    if (resultSet != null) {
+      resultSet.close()
+      resultSet = null
+    }
+    resultsExhausted = true
+    false
+  }
 
-  override def setFetchDirection(direction: Int): Unit =
-    throw new SQLFeatureNotSupportedException
+  override def setFetchDirection(direction: Int): Unit = {
+    checkOpen()
+    if (direction != ResultSet.FETCH_FORWARD) {
+      throw new SQLException(s"Fetch direction $direction is not supported.")

Review Comment:
   ditto: stringify, and please check all places



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to