Skip to content

Commit

Permalink
Rename HiveConnectorId to HiveCatalogName
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Mar 12, 2019
1 parent b7fcaa1 commit 4a06eef
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed 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 io.prestosql.plugin.hive;

import static java.util.Objects.requireNonNull;

public class HiveCatalogName
{
private final String catalogName;

public HiveCatalogName(String catalogName)
{
this.catalogName = requireNonNull(catalogName, "catalogName is null");
}

@Override
public String toString()
{
return catalogName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,9 @@
public class HiveClientModule
implements Module
{
private final String connectorId;

public HiveClientModule(String connectorId)
{
this.connectorId = connectorId;
}

@Override
public void configure(Binder binder)
{
binder.bind(HiveConnectorId.class).toInstance(new HiveConnectorId(connectorId));
binder.bind(TypeTranslator.class).toInstance(new HiveTypeTranslator());
binder.bind(CoercionPolicy.class).to(HiveCoercionPolicy.class).in(Scopes.SINGLETON);

Expand Down Expand Up @@ -119,19 +111,19 @@ public void configure(Binder binder)
@ForHiveClient
@Singleton
@Provides
public ExecutorService createHiveClientExecutor(HiveConnectorId hiveClientId)
public ExecutorService createHiveClientExecutor(HiveCatalogName catalogName)
{
return newCachedThreadPool(daemonThreadsNamed("hive-" + hiveClientId + "-%s"));
return newCachedThreadPool(daemonThreadsNamed("hive-" + catalogName + "-%s"));
}

@ForCachingHiveMetastore
@Singleton
@Provides
public ExecutorService createCachingHiveMetastoreExecutor(HiveConnectorId hiveClientId, HiveConfig hiveConfig)
public ExecutorService createCachingHiveMetastoreExecutor(HiveCatalogName catalogName, HiveConfig hiveConfig)
{
return newFixedThreadPool(
hiveConfig.getMaxMetastoreRefreshThreads(),
daemonThreadsNamed("hive-metastore-" + hiveClientId + "-%s"));
daemonThreadsNamed("hive-metastore-" + catalogName + "-%s"));
}

@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public Connector create(String catalogName, Map<String, String> config, Connecto
new MBeanModule(),
new ConnectorObjectNameGeneratorModule(catalogName),
new JsonModule(),
new HiveClientModule(catalogName),
new HiveClientModule(),
new HiveS3Module(),
new HiveGcsModule(),
new HiveMetastoreModule(metastore),
Expand All @@ -114,6 +114,7 @@ public Connector create(String catalogName, Map<String, String> config, Connecto
binder.bind(TypeManager.class).toInstance(context.getTypeManager());
binder.bind(PageIndexerFactory.class).toInstance(context.getPageIndexerFactory());
binder.bind(PageSorter.class).toInstance(context.getPageSorter());
binder.bind(HiveCatalogName.class).toInstance(new HiveCatalogName(catalogName));
});

Injector injector = app
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
package io.prestosql.plugin.hive.security;

import io.prestosql.plugin.hive.HiveConnectorId;
import io.prestosql.plugin.hive.HiveCatalogName;
import io.prestosql.plugin.hive.HiveTransactionHandle;
import io.prestosql.plugin.hive.metastore.Database;
import io.prestosql.plugin.hive.metastore.HivePrincipal;
Expand Down Expand Up @@ -86,7 +86,7 @@ public class SqlStandardAccessControl

@Inject
public SqlStandardAccessControl(
HiveConnectorId connectorId,
HiveCatalogName connectorId,
Function<HiveTransactionHandle, SemiTransactionalHiveMetastore> metastoreProvider)
{
this.connectorId = requireNonNull(connectorId, "connectorId is null").toString();
Expand Down

0 comments on commit 4a06eef

Please sign in to comment.