Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions hudi-cli/src/main/java/org/apache/hudi/cli/utils/SparkUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,18 @@ public static SparkLauncher initLauncher(String propertiesFile) throws URISyntax
}

File libDirectory = new File(new File(currentJar).getParent(), "lib");
// This lib directory may be not required, such as providing libraries through a bundle jar
if (libDirectory.exists()) {
// When directly using hudi-cli module, the jars under the lib directory
// generated by the compilation is required
Arrays.stream(libDirectory.list()).forEach(library ->
sparkLauncher.addJar(new File(libDirectory, library).getAbsolutePath()));
sparkLauncher.addJar(new File(libDirectory, library).getAbsolutePath()));
} else {
// When using hudi-cli-bundle, we also need to add the hudi-spark*-bundle
// so that the Hudi Spark job can be launched
String sparkBundleJarPath = System.getenv("SPARK_BUNDLE_JAR");
if (!StringUtils.isNullOrEmpty(sparkBundleJarPath)) {
sparkLauncher.addJar(sparkBundleJarPath);
}
}
return sparkLauncher;
}
Expand Down