From d794a3c2064b4f154d0e64928d95b0543116b6d8 Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Tue, 10 Dec 2024 15:12:44 -0500 Subject: [PATCH] reconstruct vendoe hive-exec jar --- sdks/java/io/iceberg/hive/build.gradle | 7 +- sdks/java/io/iceberg/hive/exec/build.gradle | 73 ++++++++++++--------- 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/sdks/java/io/iceberg/hive/build.gradle b/sdks/java/io/iceberg/hive/build.gradle index bfa6c75251c4..d82b9ee4b6b0 100644 --- a/sdks/java/io/iceberg/hive/build.gradle +++ b/sdks/java/io/iceberg/hive/build.gradle @@ -19,9 +19,10 @@ import groovy.json.JsonOutput */ plugins { id 'org.apache.beam.module' } applyJavaNature( - automaticModuleName: 'org.apache.beam.sdk.io.iceberg.hive', - exportJavadoc: false, - shadowClosure: {}, + automaticModuleName: 'org.apache.beam.sdk.io.iceberg.hive', + exportJavadoc: false, + publish: false, + shadowClosure: {}, ) description = "Apache Beam :: SDKs :: Java :: IO :: Iceberg :: Hive" diff --git a/sdks/java/io/iceberg/hive/exec/build.gradle b/sdks/java/io/iceberg/hive/exec/build.gradle index f266ab2ef4db..92119a78f021 100644 --- a/sdks/java/io/iceberg/hive/exec/build.gradle +++ b/sdks/java/io/iceberg/hive/exec/build.gradle @@ -21,45 +21,56 @@ plugins { id 'com.github.johnrengelman.shadow' } -dependencies { - implementation("org.apache.hive:hive-exec:3.1.3") - permitUnusedDeclared("org.apache.hive:hive-exec:3.1.3") -} +def hive_version = '3.1.3' -configurations { - shadow -} - -artifacts { - shadow(archives(shadowJar) { - builtBy shadowJar - }) -} - -shadowJar { - zip64 true - - def problematicPackages = [ +applyJavaNature( + automaticModuleName: 'org.apache.beam.sdk', + exportJavadoc: false, + publish: false, // only used for testing and in expansion-service shadowjar + shadowClosure: { + dependencies { + include(dependency("org.apache.hive:hive-exec:$hive_version")) + } + def problematicPackages = [ 'com.google.protobuf', 'com.google.common', 'shaded.parquet', 'org.apache.parquet', - 'org.joda' - ] - - problematicPackages.forEach { - relocate it, getJavaRelocatedPath("iceberg.hive.${it}") - } + 'org.apache.commons', + ] - version "3.1.3" - mergeServiceFiles() + problematicPackages.forEach { + relocate it, getJavaRelocatedPath("iceberg.hive.${it}") + } - exclude 'LICENSE' - exclude( + exclude( 'org/xml/**', 'javax/**', - 'com/sun/**' - ) -} + 'com/sun/**', + // unshaded packages + 'org/joda/**', + 'META-INF/maven/joda-time/**', + // pom.xml for relocated packages + 'META-INF/maven/com.google.guava/**', + 'META-INF/maven/com.google.protobuf/**', + 'META-INF/maven/commons-codec/**', + 'META-INF/maven/commons-lang/**', + 'META-INF/maven/commons-logging/**', + 'META-INF/maven/com.google.guava/**', + 'META-INF/maven/org.apache.parquet/**', + ) + } +) + description = "Apache Beam :: SDKs :: Java :: IO :: Iceberg :: Hive :: Exec" ext.summary = "A copy of the hive-exec dependency with some popular libraries relocated." + +dependencies { + shadow "org.apache.hive:hive-exec:$hive_version" + + // change to unshaded dependencies + shadow library.java.joda_time + + // pin to newer version hadoop dependencies + shadow "org.apache.hadoop:hadoop-yarn-server-resourcemanager:3.4.1" +}