From cc005c27d946b692afbae0228264c2f464f5e3d9 Mon Sep 17 00:00:00 2001 From: taiyang-li Date: Sat, 27 Jun 2026 11:10:57 +0800 Subject: [PATCH] [GLUTEN][CORE] Expose ColumnarBatches.isLightBatch/ensureOffloaded as public These two helpers are needed by out-of-package callers that produce or consume native-based columnar batches (e.g. a custom parquet batch writer under org.apache.spark.sql.execution.datasources), which cannot reach the package-private methods. Promote them to public so backends can reuse the batch type check and offload logic without duplicating it. Generated-by: TraeCli openrouter-3o Co-Authored-By: Aime Change-Id: I9ec9927cff51f967ae807f9b755c63776b3f8127 --- .../org/apache/gluten/columnarbatch/ColumnarBatches.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gluten-arrow/src/main/java/org/apache/gluten/columnarbatch/ColumnarBatches.java b/gluten-arrow/src/main/java/org/apache/gluten/columnarbatch/ColumnarBatches.java index 40b931d92a3..879d38f0013 100644 --- a/gluten-arrow/src/main/java/org/apache/gluten/columnarbatch/ColumnarBatches.java +++ b/gluten-arrow/src/main/java/org/apache/gluten/columnarbatch/ColumnarBatches.java @@ -95,8 +95,7 @@ static boolean isHeavyBatch(ColumnarBatch batch) { * Light batch: Data is not readable from JVM, a long int handle (which is a pointer usually) is * used to bind the batch to a native side implementation. */ - @VisibleForTesting - static boolean isLightBatch(ColumnarBatch batch) { + public static boolean isLightBatch(ColumnarBatch batch) { return identifyBatchType(batch) == BatchType.LIGHT; } @@ -128,7 +127,7 @@ public static ColumnarBatch select(String backendName, ColumnarBatch batch, int[ * Ensure the input batch is offloaded as native-based columnar batch (See {@link IndicatorVector} * and {@link PlaceholderVector}). This method will close the input column batch after offloaded. */ - static ColumnarBatch ensureOffloaded(BufferAllocator allocator, ColumnarBatch batch) { + public static ColumnarBatch ensureOffloaded(BufferAllocator allocator, ColumnarBatch batch) { if (ColumnarBatches.isLightBatch(batch)) { return batch; }