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


##########
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:
   Can we change to getColumnarLimitExecOffset and fallback when offset is not 
0 or limit < 0, then we would not need to change these codes when you support 
offset and we could also support part of CollectLimitExec operator in higher 
Spark version.



##########
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:
   Also rename to slice, thanks!



##########
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:
   Please change the name to `slice` and argument to `vector_size_t offset, 
vector_size_t length`



##########
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:
   Moreover, I would suggest to support offset in this PR, it would not expect 
too much efforts.



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