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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse;
import org.apache.hadoop.hive.ql.session.SessionState;
import org.apache.hive.jdbc.HiveDriver;
import org.apache.hudi.sync.common.AbstractSyncHoodieClient;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
Expand All @@ -62,18 +61,8 @@
public class HoodieHiveClient extends AbstractSyncHoodieClient {

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;

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 final PartitionValueExtractor partitionValueExtractor;
private IMetaStoreClient client;
Expand Down Expand Up @@ -426,7 +415,7 @@ private List<CommandProcessorResponse> updateHiveSQLs(List<String> sqls) {
private void createHiveConnection() {
if (connection == null) {
try {
Class.forName(HiveDriver.class.getCanonicalName());
Class.forName("org.apache.hive.jdbc.HiveDriver");
} catch (ClassNotFoundException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pengzhiwei2018, thanks for your contribution.
IIUC, when you are using this feature, no matter you set HIVE_USE_JDBC_OPT_KEY to true or false, the hive-jdbc jar has already been included in hudi binary jar. so this pr is unnecessary.

WDYT?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for you response @wangxianghu . When we debug code with the HIVE_USE_JDBC_OPT_KEY=false in IDE, we just include the hudi-spark dependency,the hive-jdbc is no need for us. More dependencies include may lead to more conflicts. And also IMO it is better to follow the minimization principle.If we do not use the hive jdbc, we should not include the dependency in the code.Even though the jdbc has packaged in the hudi-spark-bundle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable.

LOG.error("Unable to load Hive driver class", e);
return;
Expand Down