ngsg commented on code in PR #5771:
URL: https://github.com/apache/hive/pull/5771#discussion_r2160733697
##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java:
##########
@@ -142,2416 +40,28 @@
* so the readers of the objects in these maps should have the most recent
view of the object.
* But again, could be fragile.
*/
-public class SessionHiveMetaStoreClient extends
HiveMetaStoreClientWithLocalCache implements IMetaStoreClient {
- private static final Logger LOG =
LoggerFactory.getLogger(SessionHiveMetaStoreClient.class);
-
+public class SessionHiveMetaStoreClient extends BaseMetaStoreClientProxy
implements IMetaStoreClient {
SessionHiveMetaStoreClient(Configuration conf, Boolean allowEmbedded) throws
MetaException {
- super(conf, null, allowEmbedded);
+ super(createUnderlyingClient(conf, null, allowEmbedded));
}
SessionHiveMetaStoreClient(
Configuration conf, HiveMetaHookLoader hookLoader, Boolean
allowEmbedded) throws MetaException {
- super(conf, hookLoader, allowEmbedded);
- }
-
- private Warehouse wh = null;
-
- private Warehouse getWh() throws MetaException {
- if (wh == null) {
- wh = new Warehouse(conf);
- }
- return wh;
- }
-
- @Override
- protected void create_table(CreateTableRequest request) throws TException {
- org.apache.hadoop.hive.metastore.api.Table tbl = request.getTable();
- if (tbl.isTemporary()) {
- createTempTable(tbl);
- return;
- }
- super.create_table(request);
- }
-
- @Override
- protected void drop_table_with_environment_context(String catName, String
dbname, String name,
- boolean deleteData, EnvironmentContext envContext) throws TException,
UnsupportedOperationException {
- // First try temp table
- // TODO CAT - I think the right thing here is to always put temp tables in
the current
- // catalog. But we don't yet have a notion of current catalog, so we'll
have to hold on
- // until we do.
- org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbname,
name);
- if (table != null) {
- try {
- deleteTempTableColumnStatsForTable(dbname, name);
- } catch (NoSuchObjectException err){
- // No stats to delete, forgivable error.
- LOG.info(err.getMessage());
- }
- dropTempTable(table, deleteData, envContext);
- return;
- }
-
- // Try underlying client
- super.drop_table_with_environment_context(catName, dbname, name,
deleteData, envContext);
- }
-
- @Override
- public void truncateTable(String dbName, String tableName, List<String>
partNames) throws TException {
- // First try temp table
- org.apache.hadoop.hive.metastore.api.Table table = getTempTable(dbName,
tableName);
- if (table != null) {
- truncateTempTable(table);
- return;
- }
- // Try underlying client
- super.truncateTable(dbName, tableName, partNames);
- }
-
- @Override
- public void truncateTable(TableName tableName, List<String> partNames)
throws TException {
- // First try temp table
- org.apache.hadoop.hive.metastore.api.Table table =
getTempTable(tableName.getDb(), tableName.getTable());
- if (table != null) {
- truncateTempTable(table);
- return;
- }
- // Try underlying client
- super.truncateTable(tableName, partNames);
- }
-
- @Override
- public void truncateTable(String dbName, String tableName,
Review Comment:
No, the goal of this PR is to make each MetaStoreClient feature composable.
Therefore, `SessionHiveMetaStoreClient` should be just a composition of feature
layers, and all actual implementations of `IMetaStoreClient` should be removed
from here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]