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


##########
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 sliceBatch(ColumnarBatch batch, int limit) {

Review Comment:
   Rename to `slice` and also add offset argument



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