2424import java .util .stream .Collectors ;
2525import org .apache .hadoop .conf .Configurable ;
2626import org .apache .hadoop .conf .Configuration ;
27- import org .apache .hadoop .hive .conf .HiveConf ;
2827import org .apache .hadoop .hive .metastore .IMetaStoreClient ;
2928import org .apache .hadoop .hive .metastore .TableType ;
3029import org .apache .hadoop .hive .metastore .api .AlreadyExistsException ;
@@ -82,6 +81,8 @@ public class HiveCatalog extends BaseMetastoreViewCatalog
8281
8382 // MetastoreConf is not available with current Hive version
8483 static final String HIVE_CONF_CATALOG = "metastore.catalog.default" ;
84+ static final String HIVE_METASTORE_WAREHOUSE_DIR = "hive.metastore.warehouse.dir" ;
85+ static final String HIVE_METASTORE_URIS = "hive.metastore.uris" ;
8586
8687 private static final Logger LOG = LoggerFactory .getLogger (HiveCatalog .class );
8788
@@ -104,12 +105,12 @@ public void initialize(String inputName, Map<String, String> properties) {
104105 }
105106
106107 if (properties .containsKey (CatalogProperties .URI )) {
107- this .conf .set (HiveConf . ConfVars . METASTOREURIS . varname , properties .get (CatalogProperties .URI ));
108+ this .conf .set (HIVE_METASTORE_URIS , properties .get (CatalogProperties .URI ));
108109 }
109110
110111 if (properties .containsKey (CatalogProperties .WAREHOUSE_LOCATION )) {
111112 this .conf .set (
112- HiveConf . ConfVars . METASTOREWAREHOUSE . varname ,
113+ HIVE_METASTORE_WAREHOUSE_DIR ,
113114 LocationUtil .stripTrailingSlash (properties .get (CatalogProperties .WAREHOUSE_LOCATION )));
114115 }
115116
@@ -728,7 +729,7 @@ protected String defaultWarehouseLocation(TableIdentifier tableIdentifier) {
728729 }
729730
730731 private String databaseLocation (String databaseName ) {
731- String warehouseLocation = conf .get (HiveConf . ConfVars . METASTOREWAREHOUSE . varname );
732+ String warehouseLocation = conf .get (HIVE_METASTORE_WAREHOUSE_DIR );
732733 Preconditions .checkNotNull (
733734 warehouseLocation , "Warehouse location is not set: hive.metastore.warehouse.dir=null" );
734735 warehouseLocation = LocationUtil .stripTrailingSlash (warehouseLocation );
@@ -796,7 +797,7 @@ Database convertToDatabase(Namespace namespace, Map<String, String> meta) {
796797 public String toString () {
797798 return MoreObjects .toStringHelper (this )
798799 .add ("name" , name )
799- .add ("uri" , this .conf == null ? "" : this .conf .get (HiveConf . ConfVars . METASTOREURIS . varname ))
800+ .add ("uri" , this .conf == null ? "" : this .conf .get (HIVE_METASTORE_URIS ))
800801 .toString ();
801802 }
802803
0 commit comments