Skip to content

Commit

Permalink
Coral-Common: Add error log in HiveMscAdapter (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljfgem authored Nov 6, 2023
1 parent ae1aa48 commit 3e6fe43
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017-2022 LinkedIn Corporation. All rights reserved.
* Copyright 2017-2023 LinkedIn Corporation. All rights reserved.
* Licensed under the BSD-2 Clause license.
* See LICENSE in the project root for license information.
*/
Expand All @@ -13,10 +13,14 @@
import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class HiveMscAdapter implements HiveMetastoreClient {

private final static Logger LOG = LoggerFactory.getLogger(HiveMscAdapter.class);

private final IMetaStoreClient delegate;

public HiveMscAdapter(IMetaStoreClient msc) {
Expand All @@ -28,6 +32,7 @@ public List<String> getAllDatabases() {
try {
return delegate.getAllDatabases();
} catch (TException e) {
LOG.error("Failed to get all databases.", e);
return ImmutableList.of();
}
}
Expand All @@ -37,6 +42,7 @@ public Database getDatabase(String dbName) {
try {
return delegate.getDatabase(dbName);
} catch (TException e) {
LOG.error(String.format("Failed to get database %s.", dbName), e);
return null;
}
}
Expand All @@ -46,6 +52,7 @@ public List<String> getAllTables(String dbName) {
try {
return delegate.getAllTables(dbName);
} catch (TException e) {
LOG.error(String.format("Failed to get all tables from database %s.", dbName), e);
return ImmutableList.of();
}
}
Expand All @@ -55,6 +62,7 @@ public Table getTable(String dbName, String tableName) {
try {
return delegate.getTable(dbName, tableName);
} catch (TException e) {
LOG.error(String.format("Failed to get table %s.%s.", dbName, tableName), e);
return null;
}
}
Expand Down

0 comments on commit 3e6fe43

Please sign in to comment.