-
Notifications
You must be signed in to change notification settings - Fork 36
Separate classes under hive legacy package to new hivelink module #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
ea9fc5b
76bda7b
2e8b743
2681f10
36dae56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -495,6 +495,66 @@ project(':iceberg-hive-metastore') { | |
| } | ||
| } | ||
|
|
||
| project(':iceberg-hiveberg') { | ||
| dependencies { | ||
| compile project(':iceberg-hive-metastore') | ||
|
|
||
| compileOnly "org.apache.avro:avro" | ||
| compileOnly("org.apache.hadoop:hadoop-client") { | ||
| exclude group: 'org.apache.avro', module: 'avro' | ||
| exclude group: 'org.slf4j', module: 'slf4j-log4j12' | ||
| } | ||
|
|
||
| compileOnly("org.apache.hive:hive-metastore") { | ||
| exclude group: 'org.apache.avro', module: 'avro' | ||
| exclude group: 'org.slf4j', module: 'slf4j-log4j12' | ||
| exclude group: 'org.pentaho' // missing dependency | ||
| exclude group: 'org.apache.hbase' | ||
| exclude group: 'org.apache.logging.log4j' | ||
| exclude group: 'co.cask.tephra' | ||
| exclude group: 'com.google.code.findbugs', module: 'jsr305' | ||
| exclude group: 'org.eclipse.jetty.aggregate', module: 'jetty-all' | ||
| exclude group: 'org.eclipse.jetty.orbit', module: 'javax.servlet' | ||
| exclude group: 'org.apache.parquet', module: 'parquet-hadoop-bundle' | ||
| exclude group: 'com.tdunning', module: 'json' | ||
| exclude group: 'javax.transaction', module: 'transaction-api' | ||
| exclude group: 'com.zaxxer', module: 'HikariCP' | ||
| } | ||
|
|
||
| // By default, hive-exec is a fat/uber jar and it exports a guava library | ||
| // that's really old. We use the core classifier to be able to override our guava | ||
| // version. Luckily, hive-exec seems to work okay so far with this version of guava | ||
| // See: https://github.com/apache/hive/blob/master/ql/pom.xml#L911 for more context. | ||
| testCompile("org.apache.hive:hive-exec::core") { | ||
| exclude group: 'org.apache.avro', module: 'avro' | ||
| exclude group: 'org.slf4j', module: 'slf4j-log4j12' | ||
| exclude group: 'org.pentaho' // missing dependency | ||
| exclude group: 'org.apache.hive', module: 'hive-llap-tez' | ||
| exclude group: 'org.apache.logging.log4j' | ||
| exclude group: 'com.google.protobuf', module: 'protobuf-java' | ||
| exclude group: 'org.apache.calcite' | ||
| exclude group: 'org.apache.calcite.avatica' | ||
| exclude group: 'com.google.code.findbugs', module: 'jsr305' | ||
| } | ||
|
|
||
| testCompile("org.apache.hive:hive-metastore") { | ||
| exclude group: 'org.apache.avro', module: 'avro' | ||
| exclude group: 'org.slf4j', module: 'slf4j-log4j12' | ||
| exclude group: 'org.pentaho' // missing dependency | ||
| exclude group: 'org.apache.hbase' | ||
| exclude group: 'org.apache.logging.log4j' | ||
| exclude group: 'co.cask.tephra' | ||
| exclude group: 'com.google.code.findbugs', module: 'jsr305' | ||
| exclude group: 'org.eclipse.jetty.aggregate', module: 'jetty-all' | ||
| exclude group: 'org.eclipse.jetty.orbit', module: 'javax.servlet' | ||
| exclude group: 'org.apache.parquet', module: 'parquet-hadoop-bundle' | ||
| exclude group: 'com.tdunning', module: 'json' | ||
| exclude group: 'javax.transaction', module: 'transaction-api' | ||
| exclude group: 'com.zaxxer', module: 'HikariCP' | ||
| } | ||
| } | ||
| } | ||
|
|
||
| project(':iceberg-mr') { | ||
| configurations { | ||
| testCompile { | ||
|
|
@@ -812,6 +872,7 @@ if (jdkVersion == '8') { | |
| compile project(':iceberg-arrow') | ||
| compile project(':iceberg-hive-metastore') | ||
| compile project(':iceberg-spark') | ||
| compile project(':iceberg-hiveberg') | ||
|
||
|
|
||
| compileOnly "org.apache.avro:avro" | ||
| compileOnly("org.apache.spark:spark-hive_2.11") { | ||
|
|
@@ -921,6 +982,7 @@ project(':iceberg-spark3') { | |
| compile project(':iceberg-arrow') | ||
| compile project(':iceberg-hive-metastore') | ||
| compile project(':iceberg-spark') | ||
| compile project(':iceberg-hiveberg') | ||
|
|
||
| compileOnly "org.apache.avro:avro" | ||
| compileOnly("org.apache.spark:spark-hive_2.12") { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,6 @@ | |
| import com.github.benmanes.caffeine.cache.Caffeine; | ||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.apache.hadoop.hive.conf.HiveConf; | ||
| import org.apache.iceberg.hive.legacy.LegacyHiveCatalog; | ||
|
|
||
| public final class HiveCatalogs { | ||
|
|
||
|
|
@@ -35,20 +34,12 @@ private HiveCatalogs() { | |
| private static final Cache<String, HiveMetadataPreservingCatalog> HIVE_METADATA_PRESERVING_CATALOG_CACHE = | ||
| Caffeine.newBuilder().build(); | ||
|
|
||
| private static final Cache<String, HiveCatalog> LEGACY_CATALOG_CACHE = Caffeine.newBuilder().build(); | ||
|
|
||
| public static HiveCatalog loadCatalog(Configuration conf) { | ||
| // metastore URI can be null in local mode | ||
| String metastoreUri = conf.get(HiveConf.ConfVars.METASTOREURIS.varname, ""); | ||
| return CATALOG_CACHE.get(metastoreUri, uri -> new HiveCatalog(conf)); | ||
| } | ||
|
|
||
| public static HiveCatalog loadLegacyCatalog(Configuration conf) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a backward incompatible change? Do you have a plan on how to roll it out with Spark?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a backward incompatible change. It is not used directly from spark but from a wrapper layer. We can change the wrapper layer to accommodate this change. |
||
| // metastore URI can be null in local mode | ||
| String metastoreUri = conf.get(HiveConf.ConfVars.METASTOREURIS.varname, ""); | ||
| return LEGACY_CATALOG_CACHE.get(metastoreUri, uri -> new LegacyHiveCatalog(conf)); | ||
| } | ||
|
|
||
| /** | ||
| * @deprecated Use {@link #loadHiveMetadataPreservingCatalog(Configuration)} instead | ||
| */ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.iceberg.hiveberg; | ||
|
|
||
| import java.util.HashMap; | ||
| import org.apache.hadoop.hive.conf.HiveConf; | ||
| import org.apache.hadoop.hive.metastore.HiveMetaStoreClient; | ||
| import org.apache.hadoop.hive.metastore.api.Database; | ||
| import org.apache.iceberg.hive.HiveCatalog; | ||
| import org.junit.AfterClass; | ||
| import org.junit.BeforeClass; | ||
|
|
||
|
|
||
| /** | ||
| * Hiveberg refactoring: | ||
| * This class is copied from iceberg-hive-metastore module test code | ||
| */ | ||
| public abstract class HiveMetastoreTest { | ||
|
|
||
| protected static final String DB_NAME = "hivedb"; | ||
|
|
||
| protected static HiveMetaStoreClient metastoreClient; | ||
| protected static HiveCatalog catalog; | ||
| protected static HiveConf hiveConf; | ||
| protected static TestHiveMetastore metastore; | ||
|
|
||
| @BeforeClass | ||
| public static void startMetastore() throws Exception { | ||
| HiveMetastoreTest.metastore = new TestHiveMetastore(); | ||
| metastore.start(); | ||
| HiveMetastoreTest.hiveConf = metastore.hiveConf(); | ||
| HiveMetastoreTest.metastoreClient = new HiveMetaStoreClient(hiveConf); | ||
| String dbPath = metastore.getDatabasePath(DB_NAME); | ||
| Database db = new Database(DB_NAME, "description", dbPath, new HashMap<>()); | ||
| metastoreClient.createDatabase(db); | ||
| HiveMetastoreTest.catalog = new HiveCatalog(hiveConf); | ||
| } | ||
|
|
||
| @AfterClass | ||
| public static void stopMetastore() { | ||
| catalog.close(); | ||
| HiveMetastoreTest.catalog = null; | ||
|
|
||
| metastoreClient.close(); | ||
| HiveMetastoreTest.metastoreClient = null; | ||
|
|
||
| metastore.stop(); | ||
| HiveMetastoreTest.metastore = null; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we modifying the root
build.gradle? Why?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also clarify where these dependencies are copied from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are moving classes from legacy package to new module here as demo. This modification is needed to add a new module. If we move them to a new code repo, this change can be removed. All the dependencies are from hive-metastore
compileOnlyandtestCompiledependencies, which are necessary and cannot be pulled by pulling hive-metastore module