This is an automated email from the ASF dual-hosted git repository.
richox pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/auron.git
The following commit(s) were added to refs/heads/master by this push:
new 9e3cd118 [AURON #1437] Introduce AuronArrowFFIExporter (#1439)
9e3cd118 is described below
commit 9e3cd1185e42d7048a6c5dfdff0359d88f30d6a6
Author: zhangmang <[email protected]>
AuthorDate: Tue Oct 14 14:49:39 2025 +0800
[AURON #1437] Introduce AuronArrowFFIExporter (#1439)
* [AURON #1437] Introduce AuronArrowFFIExporter
* fix checkstyle
* fix checkstyle
* AuronArrowFFIExporter impl AutoCloseable
---
.../auron/arrowio/AuronArrowFFIExporter.java | 35 ++++++++++++++++++++++
native-engine/auron-jni-bridge/src/jni_bridge.rs | 3 +-
.../execution/auron/arrowio/ArrowFFIExporter.scala | 7 +++--
3 files changed, 41 insertions(+), 4 deletions(-)
diff --git
a/auron-core/src/main/java/org/apache/auron/arrowio/AuronArrowFFIExporter.java
b/auron-core/src/main/java/org/apache/auron/arrowio/AuronArrowFFIExporter.java
new file mode 100644
index 00000000..fbe826a9
--- /dev/null
+++
b/auron-core/src/main/java/org/apache/auron/arrowio/AuronArrowFFIExporter.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.auron.arrowio;
+
+/**
+ * Abstract class for exporting data to Arrow format via FFI (Foreign Function
Interface).
+ * This class serves as a bridge between SQL's execution engine and Arrow data
structures,
+ * allowing efficient data transfer between JVM and native code.
+ */
+public abstract class AuronArrowFFIExporter implements AutoCloseable {
+
+ /**
+ * Exports the next batch of data to Arrow format.
+ * This method is called by the native code to fetch the next batch of data
+ * from the JVM side and convert it to Arrow format.
+ *
+ * @param contextPtr Native pointer to the Arrow FFI context
+ * @return true if there is more data to export, false if all data has
been exported
+ */
+ public abstract boolean exportNextBatch(long contextPtr);
+}
diff --git a/native-engine/auron-jni-bridge/src/jni_bridge.rs
b/native-engine/auron-jni-bridge/src/jni_bridge.rs
index 7bca2ff3..ee178a49 100644
--- a/native-engine/auron-jni-bridge/src/jni_bridge.rs
+++ b/native-engine/auron-jni-bridge/src/jni_bridge.rs
@@ -1595,8 +1595,7 @@ pub struct AuronArrowFFIExporter<'a> {
}
impl<'a> AuronArrowFFIExporter<'a> {
- pub const SIG_TYPE: &'static str =
- "org/apache/spark/sql/execution/auron/arrowio/ArrowFFIExporter";
+ pub const SIG_TYPE: &'static str =
"org/apache/auron/arrowio/AuronArrowFFIExporter";
pub fn new(env: &JNIEnv<'a>) -> JniResult<AuronArrowFFIExporter<'a>> {
let class = get_global_jclass(env, Self::SIG_TYPE)?;
diff --git
a/spark-extension/src/main/scala/org/apache/spark/sql/execution/auron/arrowio/ArrowFFIExporter.scala
b/spark-extension/src/main/scala/org/apache/spark/sql/execution/auron/arrowio/ArrowFFIExporter.scala
index 926e21ef..b0f2ee32 100644
---
a/spark-extension/src/main/scala/org/apache/spark/sql/execution/auron/arrowio/ArrowFFIExporter.scala
+++
b/spark-extension/src/main/scala/org/apache/spark/sql/execution/auron/arrowio/ArrowFFIExporter.scala
@@ -36,7 +36,10 @@ import
org.apache.spark.sql.execution.auron.arrowio.util.ArrowUtils.ROOT_ALLOCAT
import org.apache.spark.sql.execution.auron.arrowio.util.ArrowWriter
import org.apache.spark.sql.types.StructType
-class ArrowFFIExporter(rowIter: Iterator[InternalRow], schema: StructType)
extends AutoCloseable {
+import org.apache.auron.arrowio.AuronArrowFFIExporter
+
+class ArrowFFIExporter(rowIter: Iterator[InternalRow], schema: StructType)
+ extends AuronArrowFFIExporter {
private val maxBatchNumRows = AuronConf.BATCH_SIZE.intConf()
private val maxBatchMemorySize = AuronConf.SUGGESTED_BATCH_MEM_SIZE.intConf()
@@ -60,7 +63,7 @@ class ArrowFFIExporter(rowIter: Iterator[InternalRow],
schema: StructType) exten
}
}
- def exportNextBatch(exportArrowArrayPtr: Long): Boolean = {
+ override def exportNextBatch(exportArrowArrayPtr: Long): Boolean = {
if (!hasNext) {
return false
}