Skip to content

Commit f8e4fae

Browse files
committed
feat(gradle): add Iceberg Hive Metastore support
- Added `iceberg-hive-metastore` dependency to Spark and Cloudera runtime configurations for Iceberg Hive catalog support. - Updated shaded runtime configuration to include `iceberg-hive-metastore`. - Enhanced documentation to reflect Iceberg Hive catalog usage and runtime isolation benefits.
1 parent 1f949fc commit f8e4fae

5 files changed

Lines changed: 12 additions & 3 deletions

File tree

doc/user-guide.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ bigDataTest {
16891689

16901690
Extension provisioning dependencies are resolved into the plugin-owned `bigDataTestExtensionRuntime` configuration. They are not added to the application `implementation`, `runtimeClasspath`, `testImplementation`, or `testRuntimeClasspath` configurations.
16911691

1692-
By default the plugin uses the shaded `extensions:<version>:runtime` artifact. This keeps Spark, Hadoop, Kafka, Avro, thin Iceberg Spark modules, and their transitive runtime dependencies managed by bigdata-test instead of letting the application dependency graph choose those versions. The extension runtime classloader prefers its own jars and delegates shared bigdata-test core types to the Gradle plugin parent classloader.
1692+
By default the plugin uses the shaded `extensions:<version>:runtime` artifact. This keeps Spark, Hadoop, Kafka, Avro, thin Iceberg Spark/Hive catalog modules, and their transitive runtime dependencies managed by bigdata-test instead of letting the application dependency graph choose those versions. The extension runtime classloader prefers its own jars and delegates shared bigdata-test core types to the Gradle plugin parent classloader.
16931693

16941694
Application dependencies such as `implementation`, `runtimeOnly`, `testImplementation`, and `testRuntimeOnly` are not added to the bigdata-test extension runtime. Dependencies explicitly added to `bigDataTestExtensionRuntime` are different: they are intentionally part of the extension runtime and can affect extension execution. Use that configuration only for optional extension-only libraries that bigdata-test does not already provide.
16951695

@@ -1823,7 +1823,7 @@ scripts = ["classpath:sql/create_tables.sql"]
18231823

18241824
Place the script at `src/main/resources/sql/create_tables.sql`, or use a `file:` URL when the SQL lives outside the project resources.
18251825

1826-
The shaded runtime jar intentionally favors isolation over small size. It uses the thin Iceberg Spark modules instead of the fat `iceberg-spark-runtime` jar, but still includes enough Hadoop, Spark, Iceberg, Kafka Avro, and AWS runtime code for config-driven provisioning without borrowing the user application's dependency graph. The largest remaining optional payload is `iceberg-aws-bundle`, which is kept for Iceberg S3 FileIO and AWS catalog support. If size or dependency inspection matters more than isolation, set `useShadedArtifact = false` and let the plugin resolve only the runtime families detected from `extensionConfig`, or add the exact artifacts you want to `bigDataTestExtensionRuntime`.
1826+
The shaded runtime jar intentionally favors isolation over small size. It uses the thin Iceberg Spark modules plus `iceberg-hive-metastore` instead of the fat `iceberg-spark-runtime` jar, but still includes enough Hadoop, Spark, Iceberg, Kafka Avro, and AWS runtime code for config-driven provisioning without borrowing the user application's dependency graph. `iceberg-hive-metastore` is required when Spark SQL preparation uses an Iceberg `HiveCatalog`. The largest remaining optional payload is `iceberg-aws-bundle`, which is kept for Iceberg S3 FileIO and AWS catalog support. If size or dependency inspection matters more than isolation, set `useShadedArtifact = false` and let the plugin resolve only the runtime families detected from `extensionConfig`, or add the exact artifacts you want to `bigDataTestExtensionRuntime`.
18271827

18281828
Gradle configuration is Gradle-native; the plugin does not read a Maven POM. When values should come from `gradle.properties` or `-P`, wire them through Gradle providers:
18291829

example/spark/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@ val clouderaSparkRuntimeClasspath = createSparkRuntimeClasspath("clouderaSparkRu
9999
dependencies {
100100
add(apacheSparkRuntimeClasspath.name, "org.apache.iceberg:iceberg-spark-3.5_2.12:$icebergVersion")
101101
add(apacheSparkRuntimeClasspath.name, "org.apache.iceberg:iceberg-spark-extensions-3.5_2.12:$icebergVersion")
102+
add(apacheSparkRuntimeClasspath.name, "org.apache.iceberg:iceberg-hive-metastore:$icebergVersion")
102103
add(apacheSparkRuntimeClasspath.name, "org.apache.logging.log4j:log4j-slf4j-impl:2.20.0")
103104
add(clouderaSparkRuntimeClasspath.name, "org.apache.iceberg:iceberg-spark-3.3_2.12")
104105
add(clouderaSparkRuntimeClasspath.name, "org.apache.iceberg:iceberg-spark-extensions-3.3_2.12")
106+
add(clouderaSparkRuntimeClasspath.name, "org.apache.iceberg:iceberg-hive-metastore")
105107
}
106108

107109
fun Test.useSparkRuntimeClasspath(runtimeClasspath: Configuration, dependencyLine: String) {

extensions/build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ dependencies {
6464
}
6565
shadedRuntime(libs.icebergSpark)
6666
shadedRuntime(libs.icebergSparkExtensions)
67+
shadedRuntime(libs.icebergHiveMetastore)
6768
shadedRuntime(libs.icebergAwsBundle)
6869
shadedRuntime(libs.servletApi)
6970
shadedRuntime(libs.kotlinxSerialization)
@@ -81,14 +82,18 @@ dependencies {
8182
testRuntimeOnly(libs.slf4jSimple)
8283
}
8384

84-
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
85+
val runtimeShadowJar = tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
8586
archiveClassifier.set("runtime")
8687
configurations = listOf(shadedRuntime)
8788
isZip64 = true
8889
mergeServiceFiles()
8990
relocate("com.fasterxml.jackson", "org.openprojectx.bigdata.test.shaded.fasterxml.jackson")
9091
}
9192

93+
tasks.withType<GenerateModuleMetadata>().configureEach {
94+
dependsOn(runtimeShadowJar)
95+
}
96+
9297
configurations.matching { it.name.startsWith("test") }.configureEach {
9398
resolutionStrategy.eachDependency {
9499
if (requested.group.startsWith("com.fasterxml.jackson")) {

gradle-plugin/src/main/kotlin/org/openprojectx/bigdata/test/gradle/BigDataTestGradlePlugin.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ class BigDataTestGradlePlugin : Plugin<Project> {
240240
dependencies.add(configuration.name, "org.apache.spark:spark-hive_2.12:${runtime.sparkVersion.get()}")
241241
dependencies.add(configuration.name, "org.apache.iceberg:iceberg-spark-3.5_2.12:${runtime.icebergVersion.get()}")
242242
dependencies.add(configuration.name, "org.apache.iceberg:iceberg-spark-extensions-3.5_2.12:${runtime.icebergVersion.get()}")
243+
dependencies.add(configuration.name, "org.apache.iceberg:iceberg-hive-metastore:${runtime.icebergVersion.get()}")
243244
dependencies.add(configuration.name, "org.apache.iceberg:iceberg-aws-bundle:${runtime.icebergVersion.get()}")
244245
dependencies.add(configuration.name, "javax.servlet:javax.servlet-api:4.0.1")
245246
}

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ hadoopClientRuntime = { module = "org.apache.hadoop:hadoop-client-runtime", vers
5555
sparkAvro = { module = "org.apache.spark:spark-avro_2.12", version.ref = "spark" }
5656
icebergSpark = { module = "org.apache.iceberg:iceberg-spark-3.5_2.12", version.ref = "iceberg" }
5757
icebergSparkExtensions = { module = "org.apache.iceberg:iceberg-spark-extensions-3.5_2.12", version.ref = "iceberg" }
58+
icebergHiveMetastore = { module = "org.apache.iceberg:iceberg-hive-metastore", version.ref = "iceberg" }
5859
icebergAwsBundle = { module = "org.apache.iceberg:iceberg-aws-bundle", version.ref = "iceberg" }
5960
gcsConnector = { module = "com.google.cloud.bigdataoss:gcs-connector", version.ref = "gcsConnector" }
6061
gcsio = { module = "com.google.cloud.bigdataoss:gcsio", version.ref = "gcsio" }

0 commit comments

Comments
 (0)