Skip to content

Commit 1f7f127

Browse files
authored
Reuse shadowJar for spark client bundle jar maven publish (#1857)
* fix spark client * fix test failure and address feedback * fix error * update regression test * update classifier name * address comment * add change * update doc * update build and readme * add back jr * udpate dependency * add change * update * update tests * remove merge service file * update readme * update readme
1 parent 45df8ac commit 1f7f127

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

build-logic/src/main/kotlin/publishing/PublishingHelperPlugin.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,6 @@ constructor(private val softwareComponentFactory: SoftwareComponentFactory) : Pl
133133

134134
suppressPomMetadataWarningsFor("testFixturesApiElements")
135135
suppressPomMetadataWarningsFor("testFixturesRuntimeElements")
136-
137-
if (project.tasks.findByName("createPolarisSparkJar") != null) {
138-
// if the project contains spark client jar, also publish the jar to maven
139-
artifact(project.tasks.named("createPolarisSparkJar").get())
140-
}
141136
}
142137

143138
if (

plugins/spark/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ Right now, the plugin only provides support for Spark 3.5, Scala version 2.12 an
2929
and depends on iceberg-spark-runtime 1.9.0.
3030

3131
# Build Plugin Jar
32-
A task createPolarisSparkJar is added to build a jar for the Polaris Spark plugin, the jar is named as:
32+
A shadowJar task is added to build a jar for the Polaris Spark plugin, the jar is named as:
3333
`polaris-spark-<sparkVersion>_<scalaVersion>-<polarisVersion>-bundle.jar`. For example:
3434
`polaris-spark-3.5_2.12-0.11.0-beta-incubating-SNAPSHOT-bundle.jar`.
3535

36-
- `./gradlew :polaris-spark-3.5_2.12:createPolarisSparkJar` -- build jar for Spark 3.5 with Scala version 2.12.
37-
- `./gradlew :polaris-spark-3.5_2.13:createPolarisSparkJar` -- build jar for Spark 3.5 with Scala version 2.13.
36+
- `./gradlew :polaris-spark-3.5_2.12:shadowJar` -- build jar for Spark 3.5 with Scala version 2.12.
37+
- `./gradlew :polaris-spark-3.5_2.13:shadowJar` -- build jar for Spark 3.5 with Scala version 2.13.
3838

3939
The result jar is located at plugins/spark/v3.5/build/<scala_version>/libs after the build.
4040

41+
The shadowJar task is also executed automatically when you run `gradlew assemble` or `gradlew build`.
42+
4143
# Start Spark with Local Polaris Service using built Jar
4244
Once the jar is built, we can manually test it with Spark and a local Polaris service.
4345

plugins/spark/v3.5/spark/build.gradle.kts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919

2020
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2121

22-
plugins { id("polaris-client") }
22+
plugins {
23+
id("polaris-client")
24+
id("com.gradleup.shadow")
25+
}
2326

2427
// get version information
2528
val sparkMajorVersion = "3.5"
@@ -112,7 +115,7 @@ dependencies {
112115
}
113116
}
114117

115-
tasks.register<ShadowJar>("createPolarisSparkJar") {
118+
tasks.named<ShadowJar>("shadowJar") {
116119
archiveClassifier = "bundle"
117120
isZip64 = true
118121

@@ -135,8 +138,11 @@ tasks.register<ShadowJar>("createPolarisSparkJar") {
135138
exclude(dependency("org.apache.avro:avro*.*"))
136139
}
137140

138-
relocate("com.fasterxml", "org.apache.polaris.shaded.com.fasterxml.jackson")
141+
relocate("com.fasterxml", "org.apache.polaris.shaded.com.fasterxml")
139142
relocate("org.apache.avro", "org.apache.polaris.shaded.org.apache.avro")
140143
}
141144

142-
tasks.withType(Jar::class).named("sourcesJar") { dependsOn("createPolarisSparkJar") }
145+
// ensure the shadowJar job is run for both `assemble` and `build` task
146+
tasks.named("assemble") { dependsOn("shadowJar") }
147+
148+
tasks.named("build") { dependsOn("shadowJar") }

site/content/in-dev/unreleased/polaris-spark-client.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,14 @@ The Polaris Spark client has the following functionality limitations:
128128
3) Rename a Delta table is not supported.
129129
4) ALTER TABLE ... SET LOCATION is not supported for DELTA table.
130130
5) For other non-Iceberg tables like csv, it is not supported.
131+
132+
## Iceberg Spark Client compatibility with Polaris Spark Client
133+
The Polaris Spark client today depends on a specific Iceberg client version, and the version dependency is described
134+
in the following table:
135+
136+
| Spark Client Version | Iceberg Spark Client Version |
137+
|----------------------|------------------------------|
138+
| 1.0.0 | 1.9.0 |
139+
140+
The Iceberg dependency is automatically downloaded when the Polaris package is downloaded, so there is no need to
141+
add the Iceberg Spark client in the `packages` configuration.

0 commit comments

Comments
 (0)