You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "pan3793 (via GitHub)" <gi...@apache.org> on 2025/10/27 10:07:59 UTC

[PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

pan3793 opened a new pull request, #52742:
URL: https://github.com/apache/spark/pull/52742

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'common/utils/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   This PR implements the two methods of the `java.sql.Statement` interface for `SparkConnectStatement`
   ```
       /**
        * Retrieves the maximum number of rows that a
        * {@code ResultSet} object produced by this
        * {@code Statement} object can contain.  If this limit is exceeded,
        * the excess rows are silently dropped.
        *
        * @return the current maximum number of rows for a {@code ResultSet}
        *         object produced by this {@code Statement} object;
        *         zero means there is no limit
        * @throws SQLException if a database access error occurs or
        * this method is called on a closed {@code Statement}
        * @see #setMaxRows
        */
       int getMaxRows() throws SQLException;
   
       /**
        * Sets the limit for the maximum number of rows that any
        * {@code ResultSet} object  generated by this {@code Statement}
        * object can contain to the given number.
        * If the limit is exceeded, the excess
        * rows are silently dropped.
        *
        * @param max the new max rows limit; zero means there is no limit
        * @throws SQLException if a database access error occurs,
        * this method is called on a closed {@code Statement}
        *            or the condition {@code max >= 0} is not satisfied
        * @see #getMaxRows
        */
       void setMaxRows(int max) throws SQLException;
   ```
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   Implement more JDBC APIs.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as new features, bug fixes, or other behavior changes. Documentation-only updates are not considered user-facing changes.
   
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   No, it's new feature.
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   New UTs are added.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   <!--
   If generative AI tooling has been used in the process of authoring this patch, please include the
   phrase: 'Generated-by: ' followed by the name of the tool and its version.
   If no, write 'No'.
   Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
   -->
   No.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #52742:
URL: https://github.com/apache/spark/pull/52742#issuecomment-3491978988

   Merged to master. Thank you, @pan3793 and @LuciferYang .


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #52742:
URL: https://github.com/apache/spark/pull/52742#issuecomment-3490175103

   rebase on master to resolve Python protobuf version mismatch issue (no code change)


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #52742:
URL: https://github.com/apache/spark/pull/52742#issuecomment-3495155077

   Oh, I backported this already to `branch-4.1` when I merged this. Sorry for making you confused by my previous wrong comment, @LuciferYang . Here is the commit.
   - https://github.com/apache/spark/commit/71599034d78686dfd119213add68fd3f519c7a2f
   
   And, yes, of course, you can backport all late arrival patches until November 15th. So, feel free to proceed as the member of Apache Spark PMC.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2493198748


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -86,7 +88,10 @@ class SparkConnectStatement(conn: SparkConnectConnection) extends Statement {
     operationId = null
     resultSet = null
 
-    val df = conn.spark.sql(sql)
+    var df = conn.spark.sql(sql)
+    if (maxRows > 0) {

Review Comment:
   0 is also meaningful user request, isn't it?
   
   ```scala
   - if (maxRows > 0) {
   + if (maxRows >= 0) {
   ```



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2480281303


##########
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:
   it does work as expected, added more test cases



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #52742:
URL: https://github.com/apache/spark/pull/52742#issuecomment-3494728023

   I'm planning to backport this pr to branch-4.1. Additionally, to make this feature basically available in Spark 4.1, there are another 9 pending tickets that I hope can be completed and merged into branch-4.1 by November 15th: https://issues.apache.org/jira/browse/SPARK-53484
   
   <img width="1014" height="334" alt="image" src="https://github.com/user-attachments/assets/fcacf971-0786-4784-b734-c7e72c8c4b97" />
   
   
    If you have any other suggestions, please let me know. @dongjoon-hyun 


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2493213345


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -86,7 +88,10 @@ class SparkConnectStatement(conn: SparkConnectConnection) extends Statement {
     operationId = null
     resultSet = null
 
-    val df = conn.spark.sql(sql)
+    var df = conn.spark.sql(sql)
+    if (maxRows > 0) {

Review Comment:
   according to the JDBC API javadoc (I pasted it in PR description)
   
   > zero means there is no limit



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2480280942


##########
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:
   thanks, fixed



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2493190034


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -86,7 +88,10 @@ class SparkConnectStatement(conn: SparkConnectConnection) extends Statement {
     operationId = null
     resultSet = null
 
-    val df = conn.spark.sql(sql)
+    var df = conn.spark.sql(sql)
+    if (limitRow > 0) {
+      df = df.limit(limitRow)

Review Comment:
   Do you mean duplicated `LIMIT`? I think it does not matter as long as the result is correct.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2480275614


##########
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:
   after a deeper look, I think I should revise the implementation of `execute*` methods first



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2492787458


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -86,7 +88,10 @@ class SparkConnectStatement(conn: SparkConnectConnection) extends Statement {
     operationId = null
     resultSet = null
 
-    val df = conn.spark.sql(sql)
+    var df = conn.spark.sql(sql)
+    if (limitRow > 0) {
+      df = df.limit(limitRow)

Review Comment:
   It seems that the issue with (SELECT * FROM table LIMIT 3).limit(5) still persists. Although Spark will optimize it.
   
   



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2485680012


##########
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:
   has been rebased on SPARK-54108



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2493187636


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -26,6 +26,8 @@ class SparkConnectStatement(conn: SparkConnectConnection) extends Statement {
   private var operationId: String = _
   private var resultSet: SparkConnectResultSet = _
 
+  private var limitRow: Int = 0

Review Comment:
   I think `@volatile` is not necessary. In practice, users may cache the `Connection` in a pool and reuse it in different threads, but `Statement` is not likely to be used in different threads, while `close` or `cancel` might be called by a different thread.
   
   Renamed `limitRow` to `maxRows`.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #52742:
URL: https://github.com/apache/spark/pull/52742#issuecomment-3495211379

   @dongjoon-hyun @LuciferYang, many thanks for your help in advancing this new feature.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2492780570


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -26,6 +26,8 @@ class SparkConnectStatement(conn: SparkConnectConnection) extends Statement {
   private var operationId: String = _
   private var resultSet: SparkConnectResultSet = _
 
+  private var limitRow: Int = 0

Review Comment:
   Should limitRow be marked as @volatile?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2492780570


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -26,6 +26,8 @@ class SparkConnectStatement(conn: SparkConnectConnection) extends Statement {
   private var operationId: String = _
   private var resultSet: SparkConnectResultSet = _
 
+  private var limitRow: Int = 0

Review Comment:
   Should `limitRow` be marked as `@volatile`?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #52742: [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement
URL: https://github.com/apache/spark/pull/52742


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #52742:
URL: https://github.com/apache/spark/pull/52742#issuecomment-3451615592

   cc @LuciferYang @dongjoon-hyun 


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2492790895


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -26,6 +26,8 @@ class SparkConnectStatement(conn: SparkConnectConnection) extends Statement {
   private var operationId: String = _
   private var resultSet: SparkConnectResultSet = _
 
+  private var limitRow: Int = 0

Review Comment:
   Would "maxRows" be a more suitable choice?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #52742:
URL: https://github.com/apache/spark/pull/52742#discussion_r2493291321


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectStatement.scala:
##########
@@ -86,7 +88,10 @@ class SparkConnectStatement(conn: SparkConnectConnection) extends Statement {
     operationId = null
     resultSet = null
 
-    val df = conn.spark.sql(sql)
+    var df = conn.spark.sql(sql)
+    if (maxRows > 0) {

Review Comment:
   Oh, I missed that. Got it!



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54014][CONNECT] Support max rows for SparkConnectStatement [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #52742:
URL: https://github.com/apache/spark/pull/52742#issuecomment-3495282211

   Thank you for your clarification and support. @dongjoon-hyun 


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org