LuciferYang commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2473281085
##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -61,7 +66,10 @@ class SparkConnectStatement(conn: SparkConnectConnection)
extends Statement {
override def executeUpdate(sql: String): Int = {
checkOpen()
- val df = conn.spark.sql(sql)
+ var df = conn.spark.sql(sql)
+ if (limitRow > 0) {
+ df = df.limit(limitRow)
Review Comment:
Why does `executeUpdate` need to support a `limit` clause?
##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -51,7 +53,10 @@ class SparkConnectStatement(conn: SparkConnectConnection)
extends Statement {
override def executeQuery(sql: String): ResultSet = {
checkOpen()
- val df = conn.spark.sql(sql)
+ var df = conn.spark.sql(sql)
+ if (limitRow > 0) {
+ df = df.limit(limitRow)
Review Comment:
If the SQL statement itself already includes a LIMIT clause, will the
behavior be as expected? Should we add test cases for the corresponding
scenarios?
##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -91,11 +99,17 @@ class SparkConnectStatement(conn: SparkConnectConnection)
extends Statement {
override def getMaxRows: Int = {
checkOpen()
- 0
+ this.limitRow
}
- override def setMaxRows(max: Int): Unit =
- throw new SQLFeatureNotSupportedException
+ override def setMaxRows(max: Int): Unit = {
+ checkOpen()
+
+ if (max < 0) {
+ throw new SQLException("The max rows must be zero or postive integer.")
Review Comment:
Typo: positive
--
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]