This is an automated email from the ASF dual-hosted git repository.
zhouyuan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new f355b22e10 [GLUTEN-13806][VL] Refactor Lance's backend-independent
code to a gluten-lance module (#13732)
f355b22e10 is described below
commit f355b22e10e4216c6f90c69d87b6b6b57796a200
Author: Mohammad Linjawi <[email protected]>
AuthorDate: Thu Nov 26 18:59:11 2026 +0300
[GLUTEN-13806][VL] Refactor Lance's backend-independent code to a
gluten-lance module (#13732)
* [VL] Move Lance's backend-independent code to a gluten-lance module
---
.github/labeler.yml | 1 +
.github/workflows/scala_code_format.yml | 1 +
.github/workflows/velox_backend_arm.yml | 5 +-
.github/workflows/velox_backend_x86.yml | 9 +-
backends-velox/pom.xml | 5 +
dev/bloop-test.sh | 1 +
dev/format-scala-code.sh | 2 +-
dev/run-scala-test.sh | 1 +
.../velox/developers/ArrowColumnarConversion.md | 6 +-
docs/backends/velox/get-started/VeloxLance.md | 9 +-
gluten-lance/pom.xml | 141 +++++++++++++++++++++
.../gluten/execution/LanceScanTransformer.scala | 0
.../apache/gluten/extension/OffloadLanceScan.scala | 0
package/pom.xml | 10 ++
pom.xml | 3 +
15 files changed, 180 insertions(+), 14 deletions(-)
diff --git a/.github/labeler.yml b/.github/labeler.yml
index 53c935892c..0291670ec8 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -81,6 +81,7 @@ DATA_LAKE:
- changed-files:
- any-glob-to-any-file:
- 'gluten-iceberg/**/*'
+ - 'gluten-lance/**/*'
- 'gluten-delta/**/*'
- 'gluten-hudi/**/*'
diff --git a/.github/workflows/scala_code_format.yml
b/.github/workflows/scala_code_format.yml
index 575cec58e2..257a005573 100644
--- a/.github/workflows/scala_code_format.yml
+++ b/.github/workflows/scala_code_format.yml
@@ -26,6 +26,7 @@ on:
- 'gluten-arrow/**'
- 'gluten-delta/**'
- 'gluten-iceberg/**'
+ - 'gluten-lance/**'
- 'gluten-hudi/**'
- 'gluten-paimon/**'
- 'gluten-ut/**'
diff --git a/.github/workflows/velox_backend_arm.yml
b/.github/workflows/velox_backend_arm.yml
index f53ac85e26..7c3ca0ebf4 100644
--- a/.github/workflows/velox_backend_arm.yml
+++ b/.github/workflows/velox_backend_arm.yml
@@ -29,6 +29,7 @@ on:
- 'gluten-arrow/**'
- 'gluten-delta/**'
- 'gluten-iceberg/**'
+ - 'gluten-lance/**'
- 'gluten-hudi/**'
- 'gluten-paimon/**'
- 'gluten-ut/**'
@@ -93,7 +94,7 @@ jobs:
uses: ./.github/actions/squash-merge-upstream
with:
# The `paths:` list above. Keep the two in sync.
- paths:
'^(\.github/workflows/velox_backend_arm\.yml$|\.github/actions/|pom\.xml$|build/mvn$|(backends-velox|gluten-(uniffle|celeborn|core|substrait|arrow|delta|iceberg|hudi|paimon|ut)|package|shims|tools/gluten-it|ep/build-velox|cpp|dev)/)'
+ paths:
'^(\.github/workflows/velox_backend_arm\.yml$|\.github/actions/|pom\.xml$|build/mvn$|(backends-velox|gluten-(uniffle|celeborn|core|substrait|arrow|delta|iceberg|lance|hudi|paimon|ut)|package|shims|tools/gluten-it|ep/build-velox|cpp|dev)/)'
paths-ignore: '^cpp/bolt/|^cpp/bolt\.CMakeLists\.cmake$'
# Detect which parts of the codebase were modified so downstream jobs can
@@ -137,7 +138,7 @@ jobs:
match() { echo "$changed" | grep -qE "$1" && echo true || echo
false; }
echo "cpp=$(match '^(cpp/|ep/build-velox/|dev/)')"
>> $GITHUB_OUTPUT
- echo "java=$(match
'^(\.github/(workflows|actions)/|pom\.xml|backends-velox/|gluten-(uniffle|celeborn|ras|core|substrait|arrow|delta|iceberg|hudi|paimon)/|gluten-ut/(common/|test/|pom\.xml)|package/|build/mvn)')"
>> $GITHUB_OUTPUT
+ echo "java=$(match
'^(\.github/(workflows|actions)/|pom\.xml|backends-velox/|gluten-(uniffle|celeborn|ras|core|substrait|arrow|delta|iceberg|lance|hudi|paimon)/|gluten-ut/(common/|test/|pom\.xml)|package/|build/mvn)')"
>> $GITHUB_OUTPUT
echo "tools_it=$(match '^tools/gluten-it/')"
>> $GITHUB_OUTPUT
build-native-lib-centos-9:
diff --git a/.github/workflows/velox_backend_x86.yml
b/.github/workflows/velox_backend_x86.yml
index 3d7906e433..cbf7cc2c30 100644
--- a/.github/workflows/velox_backend_x86.yml
+++ b/.github/workflows/velox_backend_x86.yml
@@ -34,6 +34,7 @@ on:
- 'gluten-arrow/**'
- 'gluten-delta/**'
- 'gluten-iceberg/**'
+ - 'gluten-lance/**'
- 'gluten-hudi/**'
- 'gluten-paimon/**'
- 'gluten-ut/**'
@@ -122,7 +123,7 @@ jobs:
uses: ./.github/actions/squash-merge-upstream
with:
# The `paths:` list above. Keep the two in sync.
- paths:
'^(\.github/workflows/(velox_backend_x86|iceberg_spark_ut|iceberg_upstream_revision|velox_native_build)\.yml$|\.github/workflows/util/(parallel-ut|iceberg-upstream)/|\.github/actions/|pom\.xml$|build/mvn$|(backends-velox|gluten-(uniffle|celeborn|core|substrait|arrow|delta|iceberg|hudi|paimon|ut)|package|shims|tools/gluten-it|ep/build-velox|cpp|dev)/)'
+ paths:
'^(\.github/workflows/(velox_backend_x86|iceberg_spark_ut|iceberg_upstream_revision|velox_native_build)\.yml$|\.github/workflows/util/(parallel-ut|iceberg-upstream)/|\.github/actions/|pom\.xml$|build/mvn$|(backends-velox|gluten-(uniffle|celeborn|core|substrait|arrow|delta|iceberg|lance|hudi|paimon|ut)|package|shims|tools/gluten-it|ep/build-velox|cpp|dev)/)'
paths-ignore: '^cpp/bolt/|^cpp/bolt\.CMakeLists\.cmake$'
# Detect which parts of the codebase were modified so downstream jobs can
@@ -224,7 +225,7 @@ jobs:
match() { echo "$changed" | grep -qE "$1" && echo true || echo
false; }
echo "cpp=$(match '^(cpp/|ep/build-velox/|dev/)')"
>> $GITHUB_OUTPUT
- echo "java=$(match
'^(\.github/(workflows|actions)/|pom\.xml|backends-velox/|gluten-(uniffle|celeborn|ras|core|substrait|arrow|delta|iceberg|hudi|paimon)/|gluten-ut/(common/|test/|src-iceberg-upstream/|pom\.xml)|package/|build/mvn)')"
>> $GITHUB_OUTPUT
+ echo "java=$(match
'^(\.github/(workflows|actions)/|pom\.xml|backends-velox/|gluten-(uniffle|celeborn|ras|core|substrait|arrow|delta|iceberg|lance|hudi|paimon)/|gluten-ut/(common/|test/|src-iceberg-upstream/|pom\.xml)|package/|build/mvn)')"
>> $GITHUB_OUTPUT
echo "udf=$(match
'^(backends-velox/src/test/scala/org/apache/gluten/expression/VeloxUdfSuite\.scala|\.github/workflows/velox_backend_x86\.yml)$')"
>> $GITHUB_OUTPUT
echo "jni_test=$(match
'^(\.github/workflows/velox_backend_x86\.yml|pom\.xml|gluten-(arrow|core)/pom\.xml|build/mvn|gluten-arrow/src/test/java/org/apache/gluten/jni/.*|gluten-arrow/src/main/java/org/apache/gluten/exception/JniExceptionDescriber\.java|gluten-core/src/main/java/org/apache/gluten/exception/GlutenException\.java)$')"
>> $GITHUB_OUTPUT
echo "shims34=$(match
'^(shims/(spark34|common)/|gluten-ut/spark34/)')" >>
$GITHUB_OUTPUT
@@ -1595,7 +1596,7 @@ jobs:
TAGS_EXCLUDE="org.apache.spark.tags.ExtendedSQLTest,org.apache.spark.tags.SlowHiveTest,org.apache.gluten.tags.UDFTest,org.apache.gluten.tags.EnhancedFeaturesTest,org.apache.gluten.tags.CudfTest,org.apache.gluten.tags.SkipTest"
if [ "${{ matrix.group }}" = "1" ]; then
# Group 1: streaming + gluten utils + top-level spark tests (~55
classes)
- $PARALLEL_UT $MVN_CMD clean test -Pspark-4.1 -Pscala-2.13
-Pjava-17 -Pbackends-velox -Pspark-ut -Pdelta \
+ $PARALLEL_UT $MVN_CMD clean test -Pspark-4.1 -Pscala-2.13
-Pjava-17 -Pbackends-velox -Pspark-ut -Pdelta -Plance -Plance-test \
-DargLine="-Dspark.test.home=/opt/shims/spark41/spark_home/"
-DtagsToExclude="$TAGS_EXCLUDE" \
-DwildcardSuites="org.apache.spark.sql.streaming,org.apache.spark.GlutenSortShuffleSuite,org.apache.gluten"
elif [ "${{ matrix.group }}" = "2" ]; then
@@ -1731,7 +1732,7 @@ jobs:
$MVN_CMD clean install -Pspark-4.2 -Pscala-2.13 -Pjava-17
-Pbackends-velox -Pspark-ut -Pdelta -DskipTests
if [ "${{ matrix.group }}" = "1" ]; then
# Group 1: streaming + gluten utils + top-level spark tests (~55
classes)
- $PARALLEL_UT $MVN_CMD clean test -Pspark-4.2 -Pscala-2.13
-Pjava-17 -Pbackends-velox -Pspark-ut -Pdelta \
+ $PARALLEL_UT $MVN_CMD clean test -Pspark-4.2 -Pscala-2.13
-Pjava-17 -Pbackends-velox -Pspark-ut -Pdelta -Plance -Plance-test \
-DargLine="-Dspark.test.home=/opt/shims/spark42/spark_home/"
-DtagsToExclude="$TAGS_EXCLUDE" \
-DwildcardSuites="org.apache.spark.sql.streaming,org.apache.spark.GlutenSortShuffleSuite,org.apache.gluten"
elif [ "${{ matrix.group }}" = "2" ]; then
diff --git a/backends-velox/pom.xml b/backends-velox/pom.xml
index 7f7b169802..6517d87b97 100644
--- a/backends-velox/pom.xml
+++ b/backends-velox/pom.xml
@@ -465,6 +465,11 @@
<activeByDefault>false</activeByDefault>
</activation>
<dependencies>
+ <dependency>
+ <groupId>org.apache.gluten</groupId>
+ <artifactId>gluten-lance</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!--
lance-core declares a newer Arrow than Gluten. Keep Gluten's Arrow
on the classpath (the
lance-spark bundle ships the same Arrow line as Gluten for Spark
3.x), and only add the
diff --git a/dev/bloop-test.sh b/dev/bloop-test.sh
index a341385059..af72b59f98 100755
--- a/dev/bloop-test.sh
+++ b/dev/bloop-test.sh
@@ -90,6 +90,7 @@ declare -A MODULE_MAP=(
# Data lake modules
["gluten-delta"]="gluten-delta"
["gluten-iceberg"]="gluten-iceberg"
+ ["gluten-lance"]="gluten-lance"
["gluten-hudi"]="gluten-hudi"
["gluten-paimon"]="gluten-paimon"
diff --git a/dev/format-scala-code.sh b/dev/format-scala-code.sh
index bb02aa89b6..c586c19aa2 100755
--- a/dev/format-scala-code.sh
+++ b/dev/format-scala-code.sh
@@ -21,7 +21,7 @@ MVN_CMD="${BASEDIR}/../build/mvn"
# If a new profile is introduced for new modules, please add it here to ensure
# the new modules are covered.
-PROFILES="-Pbackends-velox,backends-clickhouse -Pceleborn,uniffle
-Piceberg,delta,hudi,paimon \
+PROFILES="-Pbackends-velox,backends-clickhouse -Pceleborn,uniffle
-Piceberg,delta,hudi,paimon,lance \
-Pspark-3.4,spark-3.5,spark-4.0,spark-4.1,spark-4.2 -Pspark-ut
-Pkafka"
COMMAND=$1
diff --git a/dev/run-scala-test.sh b/dev/run-scala-test.sh
index f702179ecf..c7cc5f967e 100755
--- a/dev/run-scala-test.sh
+++ b/dev/run-scala-test.sh
@@ -177,6 +177,7 @@ declare -A MODULE_MAP=(
# Data lake modules
["gluten-delta"]="gluten-delta:scala"
["gluten-iceberg"]="gluten-iceberg:scala"
+ ["gluten-lance"]="gluten-lance:scala"
["gluten-hudi"]="gluten-hudi:scala"
["gluten-paimon"]="gluten-paimon:scala"
diff --git a/docs/backends/velox/developers/ArrowColumnarConversion.md
b/docs/backends/velox/developers/ArrowColumnarConversion.md
index 0b03ea14cd..0dda1ebbd5 100644
--- a/docs/backends/velox/developers/ArrowColumnarConversion.md
+++ b/docs/backends/velox/developers/ArrowColumnarConversion.md
@@ -343,12 +343,12 @@ and leaves every conversion to the planner. Its files:
| File | Role |
|---|---|
-|
`backends-velox/src-lance/main/scala/.../execution/LanceScanTransformer.scala`
| The operator and its RDD |
-| `backends-velox/src-lance/main/scala/.../extension/OffloadLanceScan.scala` |
The rule that replaces `BatchScanExec` |
+| `gluten-lance/src/main/scala/.../execution/LanceScanTransformer.scala` | The
operator and its RDD |
+| `gluten-lance/src/main/scala/.../extension/OffloadLanceScan.scala` | The
rule that replaces `BatchScanExec` |
|
`backends-velox/src-lance/main/scala/.../component/VeloxLanceComponent.scala` |
Registers the rule when lance-spark is on the classpath |
|
`backends-velox/src-lance/main/resources/META-INF/gluten-components/...VeloxLanceComponent`
| Makes the component discoverable |
| `backends-velox/src-lance/test/scala/.../VeloxLanceSuite.scala` | Plan
shape, results and fallback tests |
-| `pom.xml`, `backends-velox/pom.xml` | `lance` / `lance-test` profiles that
add `src-lance` |
+| `pom.xml`, `gluten-lance/pom.xml`, `backends-velox/pom.xml` | `lance` /
`lance-test` profiles that build the `gluten-lance` module and add `src-lance` |
### Step 1: Declare the convention
diff --git a/docs/backends/velox/get-started/VeloxLance.md
b/docs/backends/velox/get-started/VeloxLance.md
index 256be3a6b4..99f71dbdb7 100644
--- a/docs/backends/velox/get-started/VeloxLance.md
+++ b/docs/backends/velox/get-started/VeloxLance.md
@@ -33,12 +33,13 @@ Enable the `lance` profile alongside the Velox backend:
mvn clean package -Pbackends-velox -Pspark-3.5 -Plance -DskipTests
```
-The read-only offload is entirely Velox-specific, so it lives under
`backends-velox/src-lance`
-(mirroring `backends-velox/src-iceberg`) rather than in a top-level module.
Add `-Plance-test` to
-also compile and run the Lance test suite:
+The code is split in two. The `gluten-lance` module holds the parts that do
not depend on
+Velox, such as the scan and its offload rule. `backends-velox/src-lance`
registers them
+with the Velox backend and holds the tests that run them on Velox. Add
`-Plance-test` to also
+compile and run the Lance tests:
```
-mvn test -pl backends-velox -Pbackends-velox -Pspark-3.5 -Plance -Plance-test \
+./build/mvn test -pl gluten-lance,backends-velox -am -Pbackends-velox
-Pspark-3.5 -Plance -Plance-test \
-Dtest=none -DwildcardSuites=org.apache.gluten.execution.VeloxLanceSuite
```
diff --git a/gluten-lance/pom.xml b/gluten-lance/pom.xml
new file mode 100644
index 0000000000..e15c4d08a4
--- /dev/null
+++ b/gluten-lance/pom.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.gluten</groupId>
+ <artifactId>gluten-parent</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>gluten-lance</artifactId>
+ <packaging>jar</packaging>
+ <name>Gluten Lance</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.gluten</groupId>
+ <artifactId>gluten-substrait</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.gluten</groupId>
+ <artifactId>gluten-arrow</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.spark</groupId>
+ <artifactId>spark-core_${scala.binary.version}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.spark</groupId>
+ <artifactId>spark-catalyst_${scala.binary.version}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.spark</groupId>
+ <artifactId>spark-sql_${scala.binary.version}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!--
+ lance-core declares a newer Arrow than Gluten. Keep Gluten's Arrow on
the classpath, and only
+ add the arrow-dataset API that lance-core's scanner implements.
+ -->
+ <dependency>
+ <groupId>org.lance</groupId>
+ <artifactId>lance-spark-base_${scala.binary.version}</artifactId>
+ <version>${lance.version}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.arrow</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.arrow</groupId>
+ <artifactId>arrow-dataset</artifactId>
+ <version>${arrow.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- For test -->
+ <dependency>
+ <groupId>org.scalatest</groupId>
+ <artifactId>scalatest_${scala.binary.version}</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>net.alchim31.maven</groupId>
+ <artifactId>scala-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.scalastyle</groupId>
+ <artifactId>scalastyle-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>com.diffplug.spotless</groupId>
+ <artifactId>spotless-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.scalatest</groupId>
+ <artifactId>scalatest-maven-plugin</artifactId>
+ <configuration>
+ <junitxml>.</junitxml>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-test-jar</id>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ </plugin>
+ </plugins>
+
<outputDirectory>target/scala-${scala.binary.version}/classes</outputDirectory>
+
<testOutputDirectory>target/scala-${scala.binary.version}/test-classes</testOutputDirectory>
+ </build>
+</project>
diff --git
a/backends-velox/src-lance/main/scala/org/apache/gluten/execution/LanceScanTransformer.scala
b/gluten-lance/src/main/scala/org/apache/gluten/execution/LanceScanTransformer.scala
similarity index 100%
rename from
backends-velox/src-lance/main/scala/org/apache/gluten/execution/LanceScanTransformer.scala
rename to
gluten-lance/src/main/scala/org/apache/gluten/execution/LanceScanTransformer.scala
diff --git
a/backends-velox/src-lance/main/scala/org/apache/gluten/extension/OffloadLanceScan.scala
b/gluten-lance/src/main/scala/org/apache/gluten/extension/OffloadLanceScan.scala
similarity index 100%
rename from
backends-velox/src-lance/main/scala/org/apache/gluten/extension/OffloadLanceScan.scala
rename to
gluten-lance/src/main/scala/org/apache/gluten/extension/OffloadLanceScan.scala
diff --git a/package/pom.xml b/package/pom.xml
index 047f8d8bcb..7da88d5f66 100644
--- a/package/pom.xml
+++ b/package/pom.xml
@@ -406,6 +406,16 @@
</dependency>
</dependencies>
</profile>
+ <profile>
+ <id>lance</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.gluten</groupId>
+ <artifactId>gluten-lance</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
<profile>
<id>delta</id>
<dependencies>
diff --git a/pom.xml b/pom.xml
index 55e18c7435..561990e0c5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1976,6 +1976,9 @@
<activation>
<activeByDefault>false</activeByDefault>
</activation>
+ <modules>
+ <module>gluten-lance</module>
+ </modules>
<build>
<plugins>
<plugin>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]