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


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectConnection.scala:
##########
@@ -98,8 +98,11 @@ class SparkConnectConnection(val url: String, val info: 
Properties) extends Conn
   override def createStatement(
        resultSetType: Int,
        resultSetConcurrency: Int,
-       resultSetHoldability: Int): Statement =
-    throw new SQLFeatureNotSupportedException
+       resultSetHoldability: Int): Statement = {
+    // holdability is ignored

Review Comment:
   Done. Reverted the 3-arg `createStatement(type, concurrency, holdability)` 
to throw `SQLFeatureNotSupportedException`, matching the javadoc and the Hive 
JDBC driver. Holdability has no meaning without transaction support, so 
accepting it while ignoring the value was misleading.



##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectConnection.scala:
##########
@@ -128,8 +131,26 @@ class SparkConnectConnection(val url: String, val info: 
Properties) extends Conn
     throw new SQLFeatureNotSupportedException
 
   override def createStatement(
-      resultSetType: Int, resultSetConcurrency: Int): Statement =
-    throw new SQLFeatureNotSupportedException
+      resultSetType: Int, resultSetConcurrency: Int): Statement = {
+    checkSupportedResultSet(resultSetType, resultSetConcurrency)
+    createStatement()
+  }
+
+  // SCROLL_INSENSITIVE is accepted but the returned statement is forward-only.
+  // Mirrors the Hive JDBC driver policy used by the Spark Thrift Server.

Review Comment:
   Good catch. Spark Connect has no server-side scrollable cursor (unlike 
HiveServer2's `FETCH_FIRST`), so the code accepted `SCROLL_INSENSITIVE` but 
silently downgraded it to forward-only, which—as you said—doesn't match Hive. 
I've changed `checkSupportedResultSet` to only allow `TYPE_FORWARD_ONLY`. This 
also makes it consistent with 
`supportsResultSetType`/`supportsResultSetConcurrency`, which already advertise 
FORWARD_ONLY + READ_ONLY only. Proper scrollable support would need client-side 
materialization, so I'd prefer to do it in a follow-up. Does that sound 
reasonable?



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