[HUDI-1384] Decoupling hive jdbc dependency when HIVE_USE_JDBC_OPT_KEY set false (#2241)
This commit is contained in:
@@ -38,7 +38,6 @@ import org.apache.hadoop.hive.ql.metadata.Hive;
|
|||||||
import org.apache.hadoop.hive.ql.metadata.HiveException;
|
import org.apache.hadoop.hive.ql.metadata.HiveException;
|
||||||
import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse;
|
import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse;
|
||||||
import org.apache.hadoop.hive.ql.session.SessionState;
|
import org.apache.hadoop.hive.ql.session.SessionState;
|
||||||
import org.apache.hive.jdbc.HiveDriver;
|
|
||||||
import org.apache.hudi.sync.common.AbstractSyncHoodieClient;
|
import org.apache.hudi.sync.common.AbstractSyncHoodieClient;
|
||||||
import org.apache.log4j.LogManager;
|
import org.apache.log4j.LogManager;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@@ -62,18 +61,8 @@ import java.util.stream.Collectors;
|
|||||||
public class HoodieHiveClient extends AbstractSyncHoodieClient {
|
public class HoodieHiveClient extends AbstractSyncHoodieClient {
|
||||||
|
|
||||||
private static final String HOODIE_LAST_COMMIT_TIME_SYNC = "last_commit_time_sync";
|
private static final String HOODIE_LAST_COMMIT_TIME_SYNC = "last_commit_time_sync";
|
||||||
// Make sure we have the hive JDBC driver in classpath
|
|
||||||
private static String driverName = HiveDriver.class.getName();
|
|
||||||
private static final String HIVE_ESCAPE_CHARACTER = HiveSchemaUtil.HIVE_ESCAPE_CHARACTER;
|
private static final String HIVE_ESCAPE_CHARACTER = HiveSchemaUtil.HIVE_ESCAPE_CHARACTER;
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
Class.forName(driverName);
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
throw new IllegalStateException("Could not find " + driverName + " in classpath. ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Logger LOG = LogManager.getLogger(HoodieHiveClient.class);
|
private static final Logger LOG = LogManager.getLogger(HoodieHiveClient.class);
|
||||||
private final PartitionValueExtractor partitionValueExtractor;
|
private final PartitionValueExtractor partitionValueExtractor;
|
||||||
private IMetaStoreClient client;
|
private IMetaStoreClient client;
|
||||||
@@ -426,7 +415,7 @@ public class HoodieHiveClient extends AbstractSyncHoodieClient {
|
|||||||
private void createHiveConnection() {
|
private void createHiveConnection() {
|
||||||
if (connection == null) {
|
if (connection == null) {
|
||||||
try {
|
try {
|
||||||
Class.forName(HiveDriver.class.getCanonicalName());
|
Class.forName("org.apache.hive.jdbc.HiveDriver");
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
LOG.error("Unable to load Hive driver class", e);
|
LOG.error("Unable to load Hive driver class", e);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user