1
0

[HUDI-306] Support Glue catalog and other hive metastore implementations (#961)

- Support Glue catalog and other metastore implementations
- Remove shading from hudi utilities bundle
- Add maven profile to optionally shade hive in utilities bundle
This commit is contained in:
Udit Mehrotra
2019-11-11 17:27:31 -08:00
committed by vinoth chandar
parent 1032fc3e54
commit 0bb5999f79
4 changed files with 56 additions and 63 deletions

View File

@@ -38,10 +38,12 @@ import java.util.stream.Collectors;
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.HiveMetaStoreClient; import org.apache.hadoop.hive.metastore.IMetaStoreClient;
import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.api.Partition; import org.apache.hadoop.hive.metastore.api.Partition;
import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.hadoop.hive.ql.metadata.Hive;
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.hive.jdbc.HiveDriver;
@@ -85,7 +87,7 @@ public class HoodieHiveClient {
private final HoodieTableMetaClient metaClient; private final HoodieTableMetaClient metaClient;
private final HoodieTableType tableType; private final HoodieTableType tableType;
private final PartitionValueExtractor partitionValueExtractor; private final PartitionValueExtractor partitionValueExtractor;
private HiveMetaStoreClient client; private IMetaStoreClient client;
private HiveSyncConfig syncConfig; private HiveSyncConfig syncConfig;
private FileSystem fs; private FileSystem fs;
private Connection connection; private Connection connection;
@@ -106,8 +108,8 @@ public class HoodieHiveClient {
createHiveConnection(); createHiveConnection();
} }
try { try {
this.client = new HiveMetaStoreClient(configuration); this.client = Hive.get(configuration).getMSC();
} catch (MetaException e) { } catch (MetaException | HiveException e) {
throw new HoodieHiveSyncException("Failed to create HiveMetaStoreClient", e); throw new HoodieHiveSyncException("Failed to create HiveMetaStoreClient", e);
} }
@@ -609,7 +611,7 @@ public class HoodieHiveClient {
connection.close(); connection.close();
} }
if (client != null) { if (client != null) {
client.close(); Hive.closeCurrent();
client = null; client = null;
} }
} catch (SQLException e) { } catch (SQLException e) {

View File

@@ -105,31 +105,31 @@
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hive.jdbc.</pattern> <pattern>org.apache.hive.jdbc.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hive.jdbc.</shadedPattern> <shadedPattern>${spark.bundle.hive.shade.prefix}org.apache.hive.jdbc.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hadoop.hive.metastore.</pattern> <pattern>org.apache.hadoop.hive.metastore.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.metastore.</shadedPattern> <shadedPattern>${spark.bundle.hive.shade.prefix}org.apache.hadoop.hive.metastore.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hive.common.</pattern> <pattern>org.apache.hive.common.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hive.common.</shadedPattern> <shadedPattern>${spark.bundle.hive.shade.prefix}org.apache.hive.common.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hadoop.hive.common.</pattern> <pattern>org.apache.hadoop.hive.common.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.common.</shadedPattern> <shadedPattern>${spark.bundle.hive.shade.prefix}org.apache.hadoop.hive.common.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hadoop.hive.conf.</pattern> <pattern>org.apache.hadoop.hive.conf.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.conf.</shadedPattern> <shadedPattern>${spark.bundle.hive.shade.prefix}org.apache.hadoop.hive.conf.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hive.service.</pattern> <pattern>org.apache.hive.service.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hive.service.</shadedPattern> <shadedPattern>${spark.bundle.hive.shade.prefix}org.apache.hive.service.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hadoop.hive.service.</pattern> <pattern>org.apache.hadoop.hive.service.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.service.</shadedPattern> <shadedPattern>${spark.bundle.hive.shade.prefix}org.apache.hadoop.hive.service.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>com.codahale.metrics.</pattern> <pattern>com.codahale.metrics.</pattern>
@@ -144,40 +144,6 @@
<shadedPattern>org.apache.hudi.com.databricks.</shadedPattern> <shadedPattern>org.apache.hudi.com.databricks.</shadedPattern>
</relocation> </relocation>
<!-- TODO: Revisit GH ISSUE #533 & PR#633--> <!-- TODO: Revisit GH ISSUE #533 & PR#633-->
<!--
<relocation>
<pattern>org.apache.hive.jdbc.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hive.jdbc.</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.hadoop.hive.metastore.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.metastore.</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.hive.common.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hive.common.</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.hadoop.hive.common.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.common.</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.hadoop.hive.conf.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.conf.</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.hive.service.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hive.service.</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.hadoop.hive.service.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.service.</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.hadoop.hive.serde2.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.serde2.</shadedPattern>
</relocation>
-->
</relocations> </relocations>
<filters> <filters>
<filter> <filter>
@@ -246,37 +212,48 @@
<groupId>${hive.groupid}</groupId> <groupId>${hive.groupid}</groupId>
<artifactId>hive-service</artifactId> <artifactId>hive-service</artifactId>
<version>${hive.version}</version> <version>${hive.version}</version>
<scope>compile</scope> <scope>${spark.bundle.hive.scope}</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${hive.groupid}</groupId> <groupId>${hive.groupid}</groupId>
<artifactId>hive-service-rpc</artifactId> <artifactId>hive-service-rpc</artifactId>
<version>${hive.version}</version> <version>${hive.version}</version>
<scope>compile</scope> <scope>${spark.bundle.hive.scope}</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${hive.groupid}</groupId> <groupId>${hive.groupid}</groupId>
<artifactId>hive-jdbc</artifactId> <artifactId>hive-jdbc</artifactId>
<version>${hive.version}</version> <version>${hive.version}</version>
<scope>compile</scope> <scope>${spark.bundle.hive.scope}</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${hive.groupid}</groupId> <groupId>${hive.groupid}</groupId>
<artifactId>hive-metastore</artifactId> <artifactId>hive-metastore</artifactId>
<version>${hive.version}</version> <version>${hive.version}</version>
<scope>compile</scope> <scope>${spark.bundle.hive.scope}</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${hive.groupid}</groupId> <groupId>${hive.groupid}</groupId>
<artifactId>hive-common</artifactId> <artifactId>hive-common</artifactId>
<version>${hive.version}</version> <version>${hive.version}</version>
<scope>compile</scope> <scope>${spark.bundle.hive.scope}</scope>
</dependency> </dependency>
<!-- TODO: Reinvestigate PR 633 --> <!-- TODO: Reinvestigate PR 633 -->
</dependencies> </dependencies>
<profiles>
<profile>
<id>spark-bundle-shade-hive</id>
<properties>
<spark.bundle.hive.scope>compile</spark.bundle.hive.scope>
<spark.bundle.hive.shade.prefix>org.apache.hudi.</spark.bundle.hive.shade.prefix>
</properties>
</profile>
</profiles>
</project> </project>

View File

@@ -113,31 +113,31 @@
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hive.jdbc.</pattern> <pattern>org.apache.hive.jdbc.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hive.jdbc.</shadedPattern> <shadedPattern>${utilities.bundle.hive.shade.prefix}org.apache.hive.jdbc.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hadoop.hive.metastore.</pattern> <pattern>org.apache.hadoop.hive.metastore.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.metastore.</shadedPattern> <shadedPattern>${utilities.bundle.hive.shade.prefix}org.apache.hadoop.hive.metastore.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hive.common.</pattern> <pattern>org.apache.hive.common.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hive.common.</shadedPattern> <shadedPattern>${utilities.bundle.hive.shade.prefix}org.apache.hive.common.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hadoop.hive.common.</pattern> <pattern>org.apache.hadoop.hive.common.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.common.</shadedPattern> <shadedPattern>${utilities.bundle.hive.shade.prefix}org.apache.hadoop.hive.common.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hadoop.hive.conf.</pattern> <pattern>org.apache.hadoop.hive.conf.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.conf.</shadedPattern> <shadedPattern>${utilities.bundle.hive.shade.prefix}org.apache.hadoop.hive.conf.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hive.service.</pattern> <pattern>org.apache.hive.service.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hive.service.</shadedPattern> <shadedPattern>${utilities.bundle.hive.shade.prefix}org.apache.hive.service.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.hadoop.hive.service.</pattern> <pattern>org.apache.hadoop.hive.service.</pattern>
<shadedPattern>org.apache.hudi.org.apache.hadoop_hive.service.</shadedPattern> <shadedPattern>${utilities.bundle.hive.shade.prefix}org.apache.hadoop.hive.service.</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>com.codahale.metrics.</pattern> <pattern>com.codahale.metrics.</pattern>
@@ -221,36 +221,46 @@
<groupId>${hive.groupid}</groupId> <groupId>${hive.groupid}</groupId>
<artifactId>hive-service</artifactId> <artifactId>hive-service</artifactId>
<version>${hive.version}</version> <version>${hive.version}</version>
<scope>compile</scope> <scope>${utilities.bundle.hive.scope}</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${hive.groupid}</groupId> <groupId>${hive.groupid}</groupId>
<artifactId>hive-service-rpc</artifactId> <artifactId>hive-service-rpc</artifactId>
<version>${hive.version}</version> <version>${hive.version}</version>
<scope>compile</scope> <scope>${utilities.bundle.hive.scope}</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${hive.groupid}</groupId> <groupId>${hive.groupid}</groupId>
<artifactId>hive-jdbc</artifactId> <artifactId>hive-jdbc</artifactId>
<version>${hive.version}</version> <version>${hive.version}</version>
<scope>compile</scope> <scope>${utilities.bundle.hive.scope}</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${hive.groupid}</groupId> <groupId>${hive.groupid}</groupId>
<artifactId>hive-metastore</artifactId> <artifactId>hive-metastore</artifactId>
<version>${hive.version}</version> <version>${hive.version}</version>
<scope>compile</scope> <scope>${utilities.bundle.hive.scope}</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${hive.groupid}</groupId> <groupId>${hive.groupid}</groupId>
<artifactId>hive-common</artifactId> <artifactId>hive-common</artifactId>
<version>${hive.version}</version> <version>${hive.version}</version>
<scope>compile</scope> <scope>${utilities.bundle.hive.scope}</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>utilities-bundle-shade-hive</id>
<properties>
<utilities.bundle.hive.scope>compile</utilities.bundle.hive.scope>
<utilities.bundle.hive.shade.prefix>org.apache.hudi.</utilities.bundle.hive.shade.prefix>
</properties>
</profile>
</profiles>
</project> </project>

View File

@@ -102,6 +102,10 @@
<main.basedir>${project.basedir}</main.basedir> <main.basedir>${project.basedir}</main.basedir>
<mr.bundle.avro.scope>provided</mr.bundle.avro.scope> <mr.bundle.avro.scope>provided</mr.bundle.avro.scope>
<mr.bundle.avro.shade.prefix></mr.bundle.avro.shade.prefix> <mr.bundle.avro.shade.prefix></mr.bundle.avro.shade.prefix>
<spark.bundle.hive.scope>provided</spark.bundle.hive.scope>
<spark.bundle.hive.shade.prefix></spark.bundle.hive.shade.prefix>
<utilities.bundle.hive.scope>provided</utilities.bundle.hive.scope>
<utilities.bundle.hive.shade.prefix></utilities.bundle.hive.shade.prefix>
</properties> </properties>
<scm> <scm>