1
0

[HUDI-2499] Making jdbc-url, user and pass as non-required field for other sync modes (#3732)

This commit is contained in:
Vinay Patil
2021-09-30 21:11:15 +05:30
committed by GitHub
parent 47ed917999
commit 73e8ba7620
2 changed files with 7 additions and 3 deletions

View File

@@ -40,13 +40,13 @@ public class HiveSyncConfig implements Serializable {
@Parameter(names = {"--base-file-format"}, description = "Format of the base files (PARQUET (or) HFILE)")
public String baseFileFormat = "PARQUET";
@Parameter(names = {"--user"}, description = "Hive username", required = true)
@Parameter(names = {"--user"}, description = "Hive username")
public String hiveUser;
@Parameter(names = {"--pass"}, description = "Hive password", required = true)
@Parameter(names = {"--pass"}, description = "Hive password")
public String hivePass;
@Parameter(names = {"--jdbc-url"}, description = "Hive jdbc connect url", required = true)
@Parameter(names = {"--jdbc-url"}, description = "Hive jdbc connect url")
public String jdbcUrl;
@Parameter(names = {"--base-path"}, description = "Basepath of hoodie table to sync", required = true)

View File

@@ -33,6 +33,7 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* This class offers DDL executor backed by the jdbc This class preserves the old useJDBC = true way of doing things.
@@ -44,6 +45,9 @@ public class JDBCExecutor extends QueryBasedDDLExecutor {
public JDBCExecutor(HiveSyncConfig config, FileSystem fs) {
super(config, fs);
Objects.requireNonNull(config.jdbcUrl, "--jdbc-url option is required for jdbc sync mode");
Objects.requireNonNull(config.hiveUser, "--user option is required for jdbc sync mode");
Objects.requireNonNull(config.hivePass, "--pass option is required for jdbc sync mode");
this.config = config;
createHiveConnection(config.jdbcUrl, config.hiveUser, config.hivePass);
}