commit 8aa8dd277817a1f3c0636f8aa626ed3927517d12 Author: Alan Gates Date: Wed May 16 15:20:16 2018 -0700 HIVE-19576 IHMSHandler.getTable not always fetching the right catalog diff --git ql/src/java/org/apache/hadoop/hive/ql/security/authorization/AuthorizationPreEventListener.java ql/src/java/org/apache/hadoop/hive/ql/security/authorization/AuthorizationPreEventListener.java index 16efb721f4..2cc057ee6e 100644 --- ql/src/java/org/apache/hadoop/hive/ql/security/authorization/AuthorizationPreEventListener.java +++ ql/src/java/org/apache/hadoop/hive/ql/security/authorization/AuthorizationPreEventListener.java @@ -464,8 +464,10 @@ public PartitionWrapper(org.apache.hadoop.hive.ql.metadata.Table table, public PartitionWrapper(org.apache.hadoop.hive.metastore.api.Partition mapiPart, PreEventContext context) throws HiveException, NoSuchObjectException, MetaException { org.apache.hadoop.hive.metastore.api.Partition wrapperApiPart = mapiPart.deepCopy(); + String catName = mapiPart.isSetCatName() ? mapiPart.getCatName() : + MetaStoreUtils.getDefaultCatalog(context.getHandler().getConf()); org.apache.hadoop.hive.metastore.api.Table t = context.getHandler().get_table_core( - mapiPart.getDbName(), mapiPart.getTableName()); + catName, mapiPart.getDbName(), mapiPart.getTableName()); if (wrapperApiPart.getSd() == null){ // In the cases of create partition, by the time this event fires, the partition // object has not yet come into existence, and thus will not yet have a diff --git standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IHMSHandler.java standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IHMSHandler.java index 1a81dc9b36..29c98d1fa7 100644 --- standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IHMSHandler.java +++ standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IHMSHandler.java @@ -91,21 +91,6 @@ Table get_table_core(final String catName, final String dbname, final String nam throws MetaException, NoSuchObjectException; /** - * Equivalent of get_table, but does not log audits and fire pre-event listener. - * Meant to be used for calls made by other hive classes, that are not using the - * thrift interface. Uses the configured catalog. - * @param dbName database name - * @param name table name - * @return Table object - * @throws NoSuchObjectException If the table does not exist. - * @throws MetaException If another error occurs. - */ - default Table get_table_core(final String dbName, final String name) - throws MetaException, NoSuchObjectException { - return get_table_core(MetaStoreUtils.getDefaultCatalog(getConf()), dbName, name); - } - - /** * Get a list of all transactional listeners. * @return list of listeners. */