ArnavBalyan commented on code in PR #8566:
URL: https://github.com/apache/incubator-gluten/pull/8566#discussion_r1930068527


##########
backends-velox/src/main/java/org/apache/gluten/columnarbatch/VeloxColumnarBatches.java:
##########
@@ -123,4 +123,31 @@ public static ColumnarBatch compose(ColumnarBatch... 
batches) {
     final long handle = 
VeloxColumnarBatchJniWrapper.create(runtime).compose(handles);
     return ColumnarBatches.create(handle);
   }
+
+  /**
+   * Returns a new ColumnarBatch that contains at most `limit` rows from the 
given batch.
+   *
+   * <p>If `limit >= batch.numRows()`, returns the original batch. Otherwise, 
copies up to `limit`
+   * rows into new column vectors.
+   *
+   * @param batch the original batch
+   * @param limit the maximum number of rows to include
+   * @return a new pruned [[ColumnarBatch]] with row count = `limit`, or the 
original batch if no
+   *     pruning is required
+   */
+  public static ColumnarBatch pruneBatch(ColumnarBatch batch, int limit) {

Review Comment:
   updated this! 



##########
backends-velox/src/main/java/org/apache/gluten/columnarbatch/VeloxColumnarBatchJniWrapper.java:
##########
@@ -34,6 +34,8 @@ public static VeloxColumnarBatchJniWrapper create(Runtime 
runtime) {
 
   public native long compose(long[] batches);
 
+  public native long sliceBatch(long veloxBatchHandle, int limit);

Review Comment:
   Is the `vector_size_t` also accessible in Java? We may have to continue 
using long here, and can probably cast to vector_size_t in the cc code. Updated 
to slice thanks



##########
shims/spark34/src/main/scala/org/apache/gluten/sql/shims/spark34/Spark34Shims.scala:
##########
@@ -530,4 +530,7 @@ class Spark34Shims extends SparkShims {
         false
     }
   }
+
+  override def isColumnarLimitExecSupported(): Boolean = false

Review Comment:
   Had intentionally not introduced the notion of offset, since Spark 32/33 
don't support it. Else it maybe misleading to accept offset but not support it. 
Just wanted to confirm before updating this. Please let me know
   We need this for our Spark 33 workloads falling back, there is some effort 
needed for offset support which I'll be able to add in the upcoming PR and can 
support Spark 34 and 35. Would that work? thanks! cc @FelixYBW 



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