public static Catalog filterCatalogIfEnabled(
      boolean isFilterEnabled,
      MetaStoreFilterHook filterHook,
      Catalog catalog
  ) throws MetaException, NoSuchObjectException {
    if (isFilterEnabled) {
      Catalog filteredCatalog = filterHook.filterCatalog(catalog);

      if (filteredCatalog == null) {
        throw new NoSuchObjectException("Catalog " + catalog.getName() + " not found.");
      }
    }

    return  catalog;
  }
Filter the catalog if filtering is enabled; Otherwise, return original object
@param isFilterEnabled true: filtering is enabled; false: filtring is disabled.
@param filterHook: the object that does filtering
@param catalog: the catalog object
@return the catalog object that current user has access or filtering is disabled;
        Otherwise, throw NoSuchObjectException
@throws MetaException
@throws NoSuchObjectException
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/FilterUtils.java