heyihong commented on code in PR #52271:
URL: https://github.com/apache/spark/pull/52271#discussion_r2340476581


##########
sql/connect/server/src/main/scala/org/apache/spark/sql/connect/service/ExecuteHolder.scala:
##########
@@ -76,6 +76,34 @@ private[connect] class ExecuteHolder(
     }
   }
 
+  /**
+   * If result chunking is enabled, it will split large arrow batches into 
smaller chunks in
+   * responses.
+   */
+  lazy val resultChunkingEnabled: Boolean = {
+    
sessionHolder.session.conf.get(CONNECT_SESSION_RESULT_CHUNKING_MAX_CHUNK_SIZE) 
> 0 &&
+    request.getRequestOptionsList.asScala.exists { option =>
+      option.hasResultChunkingOptions &&
+      option.getResultChunkingOptions.getAllowArrowBatchChunking == true
+    }
+  }
+
+  /**
+   * The optional preferred arrow chunk size set by the client.
+   */
+  lazy val preferredArrowChunkSize: Option[Int] = {
+    if (resultChunkingEnabled) {
+      request.getRequestOptionsList.asScala.iterator.collectFirst {
+        case option
+            if option.hasResultChunkingOptions &&
+              option.getResultChunkingOptions.hasPreferredArrowChunkSize =>

Review Comment:
   nit: `option.getResultChunkingOptions.hasPreferredArrowChunkSize` is 
sufficient



##########
sql/connect/server/src/main/scala/org/apache/spark/sql/connect/service/ExecuteHolder.scala:
##########
@@ -76,6 +76,34 @@ private[connect] class ExecuteHolder(
     }
   }
 
+  /**
+   * If result chunking is enabled, it will split large arrow batches into 
smaller chunks in
+   * responses.
+   */
+  lazy val resultChunkingEnabled: Boolean = {
+    
sessionHolder.session.conf.get(CONNECT_SESSION_RESULT_CHUNKING_MAX_CHUNK_SIZE) 
> 0 &&
+    request.getRequestOptionsList.asScala.exists { option =>
+      option.hasResultChunkingOptions &&
+      option.getResultChunkingOptions.getAllowArrowBatchChunking == true
+    }
+  }
+
+  /**
+   * The optional preferred arrow chunk size set by the client.
+   */
+  lazy val preferredArrowChunkSize: Option[Int] = {
+    if (resultChunkingEnabled) {
+      request.getRequestOptionsList.asScala.iterator.collectFirst {
+        case option
+            if option.hasResultChunkingOptions &&
+              option.getResultChunkingOptions.hasPreferredArrowChunkSize =>

Review Comment:
   nit: `option.getResultChunkingOptions.hasPreferredArrowChunkSize` should be 
sufficient



-- 
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-unsubscr...@spark.apache.org

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


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

Reply via email to