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


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -140,11 +147,17 @@ class SparkConnectStatement(conn: SparkConnectConnection) 
extends Statement {
 
   override def getQueryTimeout: Int = {
     checkOpen()
-    0
+    queryTimeout
   }
 
-  override def setQueryTimeout(seconds: Int): Unit =
-    throw new SQLFeatureNotSupportedException
+  // stored as a hint and echoed back; Spark Connect has no client-side timeout
+  override def setQueryTimeout(seconds: Int): Unit = {
+    checkOpen()
+    if (seconds < 0) {
+      throw new SQLException("Query timeout must be zero or a positive 
integer.")
+    }
+    queryTimeout = seconds

Review Comment:
   Done. Removed the stored field — `getQueryTimeout` now always returns 0 to 
reflect the real state, and `setQueryTimeout` keeps the `checkOpen()`/`seconds 
< 0` checks but silently drops the value.



##########
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.")
+    }
+  }
 
-  override def getFetchDirection: Int =
-    throw new SQLFeatureNotSupportedException
+  override def getFetchDirection: Int = {
+    checkOpen()
+    ResultSet.FETCH_FORWARD
+  }
 
-  override def setFetchSize(rows: Int): Unit =
-    throw new SQLFeatureNotSupportedException
+  // stored as a hint; Spark Connect results are forward-only and 
server-paginated
+  override def setFetchSize(rows: Int): Unit = {

Review Comment:
   Done. Same treatment as `get/setQueryTimeout`: `getFetchSize` returns 0 and 
`setFetchSize` validates then silently drops the value. Also removed the 
now-unused `DEFAULT_FETCH_SIZE`.



-- 
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